File monitor not working in Xymon - using file list generated by wildcard
head -1 is probably a lot more standard (I've been encountering a lot of GNU scripts lately that have made me crazy). From: Larry Barber [mailto:user-6ef9c2864140@xymon.invalid] Sent: Thursday, October 04, 2012 05:39 PM To: Don Kuhlman <user-5eb2bfadc6c6@xymon.invalid> Cc: Xymon Email List <xymon at xymon.com> Subject: Re: [Xymon] File monitor not working in Xymon - using file list generated by wildcard Perhaps if you set up your client-local.cfg entry like: file:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null | sort -r | head --lines=1` so that only the most recent file (by name) will be returned. Thanks, Larry Barber On Thu, Oct 4, 2012 at 4:11 PM, Don Kuhlman <user-5eb2bfadc6c6@xymon.invalid<mailto:user-5eb2bfadc6c6@xymon.invalid>> wrote: Hi folks. I've been trying to figure this out for a while and would appreciate any help. I'm trying to monitor for a sql backup by watching for a set of files that are created every morning at 00:05 AM by a cron job on a server. There are several files created each night the sql dump runs. It creates them as filename_backup__yyyymmdd.sql So each day there are new file names created (never the same name) I want to alert if the file doesn't get created each day with the new name. I have configured the client-local.cfg file as follows: [MYSQLSERVER01] # dir:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null` # file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql file:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null` Analysis.cfg is as follows: HOST=MYSQLSERVER01 FILE %^.sql COLOR=red mtime<600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql COLOR=red mtime<600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime>86400 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<86400 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime>600 # FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql mtime>86400 noexist Xymon generates this msg when I use the full filename – eg mysqlbackup20121004.sql in analysis.cfg It doesn't work when I try to use a wildcard name (which I need because the filename will change each day) - eg FILE %^.sql Example alert is below using full real filename: Thu Oct 4 16:02:11 CDT 2012 - Files NOT ok [http://srmxymon.ambrosi.com/xymon/gifs/red.gif] /Volumes/MySQL_Backups/mysql_backup_20121004.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql> File was modified 57134 seconds ago - should be <600 [http://srmxymon.ambrosi.com/xymon/gifs/green.gif] /Volumes/MySQL_Backups/herbalife_backup_20121004.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql> Example below using %^.sql: Thu Oct 4 16:10:15 CDT 2012 - Files ok [http://srmxymon.ambrosi.com/xymon/gifs/green.gif] /Volumes/MySQL_Backups/mysql_backup_20121004.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql> [http://srmxymon.ambrosi.com/xymon/gifs/green.gif] /Volumes/MySQL_Backups/herbalife_backup_20121004.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql> Thanks Don K