If there will always be files in that directory you might want to consider getting rid of the -mtime argument to your find command. That way you will always get a file returned and then your mtime test in analysis.cfg will catch that the returned file, which should be the newest one in the directory thanks to  the sort,  is too old. <br>
<br>Thanks,<br>Larry Barber<br><br><div class="gmail_quote">On Fri, Oct 5, 2012 at 9:17 AM, Don Kuhlman <span dir="ltr"><<a href="mailto:Don.Kuhlman@schawk.com" target="_blank">Don.Kuhlman@schawk.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Ryan. Do you have any suggestions on how to get an alert if the<br>
file doesn't exist ?  It only gives me "no files checked" when the file<br>
isn't there.  That's okay if I can get that translated into an email that<br>
informs someone that no file was created.<br>
<br>
Does that make sense, or is my logic flawed ?<br>
<span class="HOEnZb"><font color="#888888"><br>
Don<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 10/5/12 9:08 AM, "Novosielski, Ryan" <<a href="mailto:novosirj@umdnj.edu">novosirj@umdnj.edu</a>> wrote:<br>
<br>
>-----BEGIN PGP SIGNED MESSAGE-----<br>
>Hash: SHA1<br>
><br>
>I'd meant there "head -1" by itself, which means "show the first<br>
>line." BTW, if you wanted to show just the last line, that would be<br>
>"tail -1".<br>
><br>
>On 10/05/2012 09:46 AM, Don Kuhlman wrote:<br>
>> Thanks Cynthia, Larry, and Ryan!<br>
>><br>
>> I modified the client-local.cfg file as below: [MYSQLSERVER01]<br>
>> file:`find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0<br>
>> 2>/dev/null | sort -r |head -1 --lines=1`<br>
>><br>
>> The webpage shows the file is present -<br>
>><br>
>><br>
>> Fri Oct 5 08:35:16 CDT 2012 - Files ok<br>
>><br>
>> green /Volumes/MySQL_Backups/mysql_backup_20121005.sql<br>
>><br>
>><<a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&" target="_blank">http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&</a><br>
>>SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql><br>
>><br>
>>  If I click the link on the webpage it gives this:<br>
>> [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]<br>
>><br>
>> type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0<br>
>> (root) group:0 (root) size:501060 clock:1349444303<br>
>> (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44)<br>
>> ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801<br>
>> (2012/10/05-00:10:01)<br>
>><br>
>> Next I changed the directory so no file matches the find command<br>
>> and then the files icon goes white and gives me the "No files<br>
>> checked" message.<br>
>><br>
>><br>
>> Fri Oct 5 08:45:23 CDT 2012 - Files ok<br>
>><br>
>> No files checked<br>
>><br>
>> Can anyone advise how I translate that into an email to our DBA to<br>
>> indicate the file doesn't exist ?<br>
>><br>
>> Thanks<br>
>><br>
>> Don K<br>
>><br>
>><br>
>> From: "Novosielski, Ryan" <<a href="mailto:novosirj@umdnj.edu">novosirj@umdnj.edu</a><br>
>> <mailto:<a href="mailto:novosirj@umdnj.edu">novosirj@umdnj.edu</a>>> Date: Fri, 5 Oct 2012 01:33:14 -0400<br>
>> To: "'<a href="mailto:lebarber@gmail.com">lebarber@gmail.com</a> <mailto:'<a href="mailto:lebarber@gmail.com">lebarber@gmail.com</a>>'"<br>
>> <<a href="mailto:lebarber@gmail.com">lebarber@gmail.com</a> <mailto:<a href="mailto:lebarber@gmail.com">lebarber@gmail.com</a>>>, Don Kuhlman<br>
>> <<a href="mailto:don.kuhlman@schawk.com">don.kuhlman@schawk.com</a> <mailto:<a href="mailto:don.kuhlman@schawk.com">don.kuhlman@schawk.com</a>>> Cc:<br>
>> "'<a href="mailto:xymon@xymon.com">xymon@xymon.com</a> <mailto:'<a href="mailto:xymon@xymon.com">xymon@xymon.com</a>>'" <<a href="mailto:xymon@xymon.com">xymon@xymon.com</a><br>
>> <mailto:<a href="mailto:xymon@xymon.com">xymon@xymon.com</a>>> Subject: Re: [Xymon] File monitor not<br>
>> working in Xymon - using file list generated by wildcard<br>
>><br>
>> head -1 is probably a lot more standard (I've been encountering a<br>
>> lot of GNU scripts lately that have made me crazy).<br>
>><br>
>><br>
>> *From*: Larry Barber [mailto:<a href="mailto:lebarber@gmail.com">lebarber@gmail.com</a>] *Sent*: Thursday,<br>
>> October 04, 2012 05:39 PM *To*: Don Kuhlman <<a href="mailto:Don.Kuhlman@schawk.com">Don.Kuhlman@schawk.com</a><br>
>> <mailto:<a href="mailto:Don.Kuhlman@schawk.com">Don.Kuhlman@schawk.com</a>>> *Cc*: Xymon Email List<br>
>> <<a href="mailto:xymon@xymon.com">xymon@xymon.com</a> <mailto:<a href="mailto:xymon@xymon.com">xymon@xymon.com</a>>> *Subject*: Re: [Xymon]<br>
>> File monitor not working in Xymon - using file list generated by<br>
>> wildcard<br>
>><br>
>> Perhaps if you set up your client-local.cfg entry like:<br>
>><br>
>> file:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0<br>
>> 2>/dev/null | sort -r | head --lines=1`<br>
>><br>
>> so that only the most recent file (by name) will be returned.<br>
>><br>
>> Thanks, Larry Barber<br>
>><br>
>><br>
>><br>
>> On Thu, Oct 4, 2012 at 4:11 PM, Don Kuhlman<br>
>> <<a href="mailto:Don.Kuhlman@schawk.com">Don.Kuhlman@schawk.com</a> <mailto:<a href="mailto:Don.Kuhlman@schawk.com">Don.Kuhlman@schawk.com</a>>> wrote:<br>
>><br>
>> Hi folks. I've been trying to figure this out for a while and<br>
>> would appreciate any help.<br>
>><br>
>> I'm trying to monitor for a sql backup by watching for a set of<br>
>> files that are created every morning at 00:05 AM by a cron job on<br>
>> a server. There are several files created each night the sql dump<br>
>> runs. It creates them as filename_backup__yyyymmdd.sql So each day<br>
>> there are new file names created (never the same name) I want to<br>
>> alert if the file doesn't get created each day with the new name.<br>
>><br>
>> I have configured the client-local.cfg file as follows:<br>
>> [MYSQLSERVER01] # dir:`find /Volumes/MySQL_Backups/ -name '*.sql'<br>
>> -mtime 0 2>/dev/null` #<br>
>> file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql file:`find<br>
>> /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null`<br>
>><br>
>> Analysis.cfg is as follows: HOST=MYSQLSERVER01 FILE %^.sql<br>
>> COLOR=red mtime<600 # FILE<br>
>> /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<600 #<br>
>> FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql COLOR=red<br>
>> mtime<600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql<br>
>> red mtime>86400 # FILE<br>
>> /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<86400 #<br>
>> FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red<br>
>> mtime>600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql<br>
>> mtime>86400 noexist<br>
>><br>
>> Xymon generates this msg when I use the full filename ­ eg<br>
>> mysqlbackup20121004.sql in analysis.cfg It doesn't work when I try<br>
>> to use a wildcard name (which I need because the filename will<br>
>> change each day) - eg FILE %^.sql<br>
>><br>
>> Example alert is below using full real filename:<br>
>><br>
>><br>
>> Thu Oct 4 16:02:11 CDT 2012 - Files NOT ok<br>
>><br>
>> red /Volumes/MySQL_Backups/mysql_backup_20121004.sql<br>
>><br>
>><<a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&" target="_blank">http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&</a><br>
>>SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql><br>
>><br>
>><br>
>File was modified 57134 seconds ago - should be <600<br>
>><br>
>><br>
>> green /Volumes/MySQL_Backups/herbalife_backup_20121004.sql<br>
>><br>
>><<a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&" target="_blank">http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&</a><br>
>>SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql><br>
>><br>
>><br>
>><br>
>> Example below using %^.sql:<br>
>><br>
>><br>
>> Thu Oct 4 16:10:15 CDT 2012 - Files ok<br>
>><br>
>> green /Volumes/MySQL_Backups/mysql_backup_20121004.sql<br>
>><br>
>><<a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&" target="_blank">http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&</a><br>
>>SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql>green<br>
>> /Volumes/MySQL_Backups/herbalife_backup_20121004.sql<br>
>><br>
>><<a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&" target="_blank">http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&</a><br>
>>SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql><br>
>><br>
>>  Thanks<br>
>><br>
>><br>
>> Don K<br>
>><br>
>><br>
>><br>
>> _______________________________________________ Xymon mailing list<br>
>> <a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a> <mailto:<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a>><br>
>> <a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
>><br>
>><br>
><br>
><br>
>- --<br>
>- ---- _  _ _  _ ___  _  _  _<br>
>|Y#| |  | |\/| |  \ |\ |  | |Ryan Novosielski - Sr. Systems Programmer<br>
>|$&| |__| |  | |__/ | \| _| |<a href="mailto:novosirj@umdnj.edu">novosirj@umdnj.edu</a> - <a href="tel:973%2F972.0922" value="+19739720922">973/972.0922</a> (2-0922)<br>
>\__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark<br>
>-----BEGIN PGP SIGNATURE-----<br>
>Version: GnuPG v1.4.11 (GNU/Linux)<br>
>Comment: Using GnuPG with Mozilla - <a href="http://www.enigmail.net/" target="_blank">http://www.enigmail.net/</a><br>
><br>
>iEYEARECAAYFAlBu6cYACgkQmb+gadEcsb4+nwCgmDPWgoqU3CArx2qcUMklTceW<br>
>ky8An1+npPWhxkVCANKk+DUu8sXkrIXO<br>
>=7gwh<br>
>-----END PGP SIGNATURE-----<br>
><br>
><br>
<br>
<br>
_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</div></div></blockquote></div><br>