File monitor not working in Xymon - using file list generated by wildcard
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
[red] /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
[green] /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
[green] /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>
[green] /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
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 <Don.Kuhlman at schawk.com> 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/nullfile:/Volumes/MySQL_Backups/mysql_backup_20121004.sql
file:
find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/nullAnalysis.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
[image: red] /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
[image: green] /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
[image: green] /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> [image: green] /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
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
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:lebarber at gmail.com] Sent: Thursday, October 04, 2012 05:39 PM To: Don Kuhlman <Don.Kuhlman at schawk.com> 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 <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>> 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
Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
Thanks Cynthia, Larry, and Ryan!
I modified the client-local.cfg file as below:
[MYSQLSERVER01]
file:find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0 2>/dev/null | sort -r |head -1 --lines=1
The webpage shows the file is present - Fri Oct 5 08:35:16 CDT 2012 - Files ok
[green] /Volumes/MySQL_Backups/mysql_backup_20121005.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
If I click the link on the webpage it gives this: [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]
type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349444303 (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44) ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801 (2012/10/05-00:10:01)
Next I changed the directory so no file matches the find command and then the files icon goes white and gives me the "No files checked" message.
Fri Oct 5 08:45:23 CDT 2012 - Files ok
No files checked
Can anyone advise how I translate that into an email to our DBA to indicate the file doesn't exist ?
Thanks
Don K
From: "Novosielski, Ryan" <novosirj at umdnj.edu<mailto:novosirj at umdnj.edu>> Date: Fri, 5 Oct 2012 01:33:14 -0400 To: "'lebarber at gmail.com<mailto:'lebarber at gmail.com>'" <lebarber at gmail.com<mailto:lebarber at gmail.com>>, Don Kuhlman <don.kuhlman at schawk.com<mailto:don.kuhlman at schawk.com>> Cc: "'xymon at xymon.com<mailto:'xymon at xymon.com>'" <xymon at xymon.com<mailto:xymon at xymon.com>> Subject: Re: [Xymon] 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:lebarber at gmail.com] Sent: Thursday, October 04, 2012 05:39 PM To: Don Kuhlman <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>> Cc: Xymon Email List <xymon at xymon.com<mailto: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 <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>> 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
[red] /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
[green] /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
[green] /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>[green] /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
Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd meant there "head -1" by itself, which means "show the first line." BTW, if you wanted to show just the last line, that would be "tail -1".
On 10/05/2012 09:46 AM, Don Kuhlman wrote:
Thanks Cynthia, Larry, and Ryan!
I modified the client-local.cfg file as below: [MYSQLSERVER01] file:
find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0 2>/dev/null | sort -r |head -1 --lines=1The webpage shows the file is present -
Fri Oct 5 08:35:16 CDT 2012 - Files ok
green /Volumes/MySQL_Backups/mysql_backup_20121005.sql <http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
If I click the link on the webpage it gives this: [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]
type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349444303 (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44) ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801 (2012/10/05-00:10:01)
Next I changed the directory so no file matches the find command and then the files icon goes white and gives me the "No files checked" message.
Fri Oct 5 08:45:23 CDT 2012 - Files ok
No files checked
Can anyone advise how I translate that into an email to our DBA to indicate the file doesn't exist ?
Thanks
Don K
From: "Novosielski, Ryan" <novosirj at umdnj.edu <mailto:novosirj at umdnj.edu>> Date: Fri, 5 Oct 2012 01:33:14 -0400 To: "'lebarber at gmail.com <mailto:'lebarber at gmail.com>'" <lebarber at gmail.com <mailto:lebarber at gmail.com>>, Don Kuhlman <don.kuhlman at schawk.com <mailto:don.kuhlman at schawk.com>> Cc: "'xymon at xymon.com <mailto:'xymon at xymon.com>'" <xymon at xymon.com <mailto:xymon at xymon.com>> Subject: Re: [Xymon] 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:lebarber at gmail.com] *Sent*: Thursday, October 04, 2012 05:39 PM *To*: Don Kuhlman <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> *Cc*: Xymon Email List <xymon at xymon.com <mailto: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=1so 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 <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> 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/nullAnalysis.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
red /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
green /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
green /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>green /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
_______________________________________________ Xymon mailing list Xymon at xymon.com <mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
- ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlBu6cYACgkQmb+gadEcsb4+nwCgmDPWgoqU3CArx2qcUMklTceW ky8An1+npPWhxkVCANKk+DUu8sXkrIXO =7gwh -----END PGP SIGNATURE-----
Thanks Ryan. Do you have any suggestions on how to get an alert if the file doesn't exist ? It only gives me "no files checked" when the file isn't there. That's okay if I can get that translated into an email that informs someone that no file was created.
Does that make sense, or is my logic flawed ?
Don
On 10/5/12 9:08 AM, "Novosielski, Ryan" <novosirj at umdnj.edu> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd meant there "head -1" by itself, which means "show the first line." BTW, if you wanted to show just the last line, that would be "tail -1".
On 10/05/2012 09:46 AM, Don Kuhlman wrote:
Thanks Cynthia, Larry, and Ryan!
I modified the client-local.cfg file as below: [MYSQLSERVER01] file:
find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0 2>/dev/null | sort -r |head -1 --lines=1The webpage shows the file is present -
Fri Oct 5 08:35:16 CDT 2012 - Files ok
green /Volumes/MySQL_Backups/mysql_backup_20121005.sql
<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01& SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
If I click the link on the webpage it gives this: [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]
type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349444303 (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44) ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801 (2012/10/05-00:10:01)
Next I changed the directory so no file matches the find command and then the files icon goes white and gives me the "No files checked" message.
Fri Oct 5 08:45:23 CDT 2012 - Files ok
No files checked
Can anyone advise how I translate that into an email to our DBA to indicate the file doesn't exist ?
Thanks
Don K
From: "Novosielski, Ryan" <novosirj at umdnj.edu <mailto:novosirj at umdnj.edu>> Date: Fri, 5 Oct 2012 01:33:14 -0400 To: "'lebarber at gmail.com <mailto:'lebarber at gmail.com>'" <lebarber at gmail.com <mailto:lebarber at gmail.com>>, Don Kuhlman <don.kuhlman at schawk.com <mailto:don.kuhlman at schawk.com>> Cc: "'xymon at xymon.com <mailto:'xymon at xymon.com>'" <xymon at xymon.com <mailto:xymon at xymon.com>> Subject: Re: [Xymon] 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:lebarber at gmail.com] *Sent*: Thursday, October 04, 2012 05:39 PM *To*: Don Kuhlman <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> *Cc*: Xymon Email List <xymon at xymon.com <mailto: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=1so 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 <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> 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/nullAnalysis.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
red /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
green /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
green /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>green /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
_______________________________________________ Xymon mailing list Xymon at xymon.com <mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
- ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlBu6cYACgkQmb+gadEcsb4+nwCgmDPWgoqU3CArx2qcUMklTceW ky8An1+npPWhxkVCANKk+DUu8sXkrIXO =7gwh -----END PGP SIGNATURE-----
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.
Thanks, Larry Barber
On Fri, Oct 5, 2012 at 9:17 AM, Don Kuhlman <Don.Kuhlman at schawk.com> wrote:
Thanks Ryan. Do you have any suggestions on how to get an alert if the file doesn't exist ? It only gives me "no files checked" when the file isn't there. That's okay if I can get that translated into an email that informs someone that no file was created.
Does that make sense, or is my logic flawed ?
Don
On 10/5/12 9:08 AM, "Novosielski, Ryan" <novosirj at umdnj.edu> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd meant there "head -1" by itself, which means "show the first line." BTW, if you wanted to show just the last line, that would be "tail -1".
On 10/05/2012 09:46 AM, Don Kuhlman wrote:
Thanks Cynthia, Larry, and Ryan!
I modified the client-local.cfg file as below: [MYSQLSERVER01] file:
find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0 2>/dev/null | sort -r |head -1 --lines=1The webpage shows the file is present -
Fri Oct 5 08:35:16 CDT 2012 - Files ok
green /Volumes/MySQL_Backups/mysql_backup_20121005.sql
< http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01& SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
If I click the link on the webpage it gives this: [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]
type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349444303 (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44) ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801 (2012/10/05-00:10:01)
Next I changed the directory so no file matches the find command and then the files icon goes white and gives me the "No files checked" message.
Fri Oct 5 08:45:23 CDT 2012 - Files ok
No files checked
Can anyone advise how I translate that into an email to our DBA to indicate the file doesn't exist ?
Thanks
Don K
From: "Novosielski, Ryan" <novosirj at umdnj.edu <mailto:novosirj at umdnj.edu>> Date: Fri, 5 Oct 2012 01:33:14 -0400 To: "'lebarber at gmail.com <mailto:'lebarber at gmail.com>'" <lebarber at gmail.com <mailto:lebarber at gmail.com>>, Don Kuhlman <don.kuhlman at schawk.com <mailto:don.kuhlman at schawk.com>> Cc: "'xymon at xymon.com <mailto:'xymon at xymon.com>'" <xymon at xymon.com <mailto:xymon at xymon.com>> Subject: Re: [Xymon] 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:lebarber at gmail.com] *Sent*: Thursday, October 04, 2012 05:39 PM *To*: Don Kuhlman <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> *Cc*: Xymon Email List <xymon at xymon.com <mailto: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=1so 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 <Don.Kuhlman at schawk.com <mailto:Don.Kuhlman at schawk.com>> 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/nullAnalysis.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
red /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
green /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
green /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>green /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
_______________________________________________ Xymon mailing list Xymon at xymon.com <mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
- ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlBu6cYACgkQmb+gadEcsb4+nwCgmDPWgoqU3CArx2qcUMklTceW ky8An1+npPWhxkVCANKk+DUu8sXkrIXO =7gwh -----END PGP SIGNATURE-----
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
Hi Larry. Thanks for the reply.
There should always be files in the directories. The dba keeps 7 days of backups and deletes anything > 8 days old. So, here's an update to see if anyone has other suggestions. It's still not working. Details on current settings for client-local.cfg and analysis.cfg are below:
Any further help or alertnative method appreciated…
Don K
client-local.cfg for mysqlserver01: [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' 2>/dev/null | sort -r | head -1
This returns a file with the latest timestamp - Fri Oct 5 12:59:57 CDT 2012 - Files ok
[green] /Volumes/MySQL_Backups/mysql_backup_20121005.sql<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
Clicking the link above gives this:
[file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql] type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349460427 (2012/10/05-13:07:07) atime:1349444863 (2012/10/05-08:47:43) ctime:1349444867 (2012/10/05-08:47:47) mtime:1349444867 (2012/10/05-08:47:47)
Hi folks. I believe the issue is my regex on the file name in the analysis.cfg. I've used about 15 different values and the only thing I seem to get working is using the direct full filename vs, a regex to match any files.
In analysis.cfg the following works as a test: FILE /Volumes/MySQL_Backups/mysql_backup_20121005.sql red mtime<600
However, using any combos that I can think of as a regex do not:
These two worked using specifc file name and syntax below
FILE /Volumes/MySQL_Backups/mysql_backup_20121005.sql red mtime<600 #FILE /Volumes/MySQL_Backups/mysql_backup_20121005.sql red mtime>86400
FILE %/Volumes/MySQL_Backups/*\.sql red mtime<86400
FILE /Volumes/MySQL_Backups/%*\.sql red mtime<600
FILE red mtime<600
#FILE /Volumes/MySQL_Backups/%.*?sql red mtime>86400
FILE %/Volumes/MySQL_Backups/*\.sql red mtime<600
#FILE %^*.sql red mtime>86400 FILE %/Volumes/MySQL_Backups/mysql_backup_%*\.sql COLOR=red mtime>86400
Can anyone suggest a way to format the analysis.cfg statement to match anything that ends in .sql ?
Thanks
Don K
From: Larry Barber <lebarber at gmail.com<mailto:lebarber at gmail.com>> Date: Fri, 5 Oct 2012 09:40:44 -0500 To: Don Kuhlman <don.kuhlman at schawk.com<mailto:don.kuhlman at schawk.com>> Cc: Xymon Email List <xymon at xymon.com<mailto:xymon at xymon.com>> Subject: Re: [Xymon] File monitor not working in Xymon - using file list generated by wildcard
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.
Thanks, Larry Barber
On Fri, Oct 5, 2012 at 9:17 AM, Don Kuhlman <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>> wrote: Thanks Ryan. Do you have any suggestions on how to get an alert if the file doesn't exist ? It only gives me "no files checked" when the file isn't there. That's okay if I can get that translated into an email that informs someone that no file was created.
Does that make sense, or is my logic flawed ?
Don
On 10/5/12 9:08 AM, "Novosielski, Ryan" <novosirj at umdnj.edu<mailto:novosirj at umdnj.edu>> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'd meant there "head -1" by itself, which means "show the first line." BTW, if you wanted to show just the last line, that would be "tail -1".
On 10/05/2012 09:46 AM, Don Kuhlman wrote:
Thanks Cynthia, Larry, and Ryan!
I modified the client-local.cfg file as below: [MYSQLSERVER01] file:
find /Volumes/MySQL_Backups/ -name "*.sql" -mtime 0 2>/dev/null | sort -r |head -1 --lines=1The webpage shows the file is present -
Fri Oct 5 08:35:16 CDT 2012 - Files ok
green /Volumes/MySQL_Backups/mysql_backup_20121005.sql
<http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01& SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql>
If I click the link on the webpage it gives this: [file:/Volumes/MySQL_Backups/mysql_backup_20121005.sql]
type:100000 (file) mode:644 (-rw-r--r--) linkcount:1 owner:0 (root) group:0 (root) size:501060 clock:1349444303 (2012/10/05-08:38:23) atime:1349425844 (2012/10/05-03:30:44) ctime:1349413801 (2012/10/05-00:10:01) mtime:1349413801 (2012/10/05-00:10:01)
Next I changed the directory so no file matches the find command and then the files icon goes white and gives me the "No files checked" message.
Fri Oct 5 08:45:23 CDT 2012 - Files ok
No files checked
Can anyone advise how I translate that into an email to our DBA to indicate the file doesn't exist ?
Thanks
Don K
From: "Novosielski, Ryan" <novosirj at umdnj.edu<mailto:novosirj at umdnj.edu> <mailto:novosirj at umdnj.edu<mailto:novosirj at umdnj.edu>>> Date: Fri, 5 Oct 2012 01:33:14 -0400 To: "'lebarber at gmail.com<mailto:lebarber at gmail.com> <mailto:'lebarber at gmail.com<mailto:lebarber at gmail.com>>'" <lebarber at gmail.com<mailto:lebarber at gmail.com> <mailto:lebarber at gmail.com<mailto:lebarber at gmail.com>>>, Don Kuhlman <don.kuhlman at schawk.com<mailto:don.kuhlman at schawk.com> <mailto:don.kuhlman at schawk.com<mailto:don.kuhlman at schawk.com>>> Cc: "'xymon at xymon.com<mailto:xymon at xymon.com> <mailto:'xymon at xymon.com<mailto:xymon at xymon.com>>'" <xymon at xymon.com<mailto:xymon at xymon.com> <mailto:xymon at xymon.com<mailto:xymon at xymon.com>>> Subject: Re: [Xymon] 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:lebarber at gmail.com<mailto:lebarber at gmail.com>] *Sent*: Thursday, October 04, 2012 05:39 PM *To*: Don Kuhlman <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com> <mailto:Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>>> *Cc*: Xymon Email List <xymon at xymon.com<mailto:xymon at xymon.com> <mailto:xymon at xymon.com<mailto: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=1so 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 <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com> <mailto:Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>>> 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/nullAnalysis.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
red /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
green /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
green /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>green /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
_______________________________________________ Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> <mailto:Xymon at xymon.com<mailto:Xymon at xymon.com>> http://lists.xymon.com/mailman/listinfo/xymon
- ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu<mailto:novosirj at umdnj.edu> - 973/972.0922<tel:973%2F972.0922> (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlBu6cYACgkQmb+gadEcsb4+nwCgmDPWgoqU3CArx2qcUMklTceW ky8An1+npPWhxkVCANKk+DUu8sXkrIXO =7gwh -----END PGP SIGNATURE-----
Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
On 6 October 2012 05:49, Don Kuhlman <Don.Kuhlman at schawk.com> wrote:
Hi folks. I believe the issue is my regex on the file name in the analysis.cfg. I've used about 15 different values and the only thing I seem to get working is using the direct full filename vs, a regex to match any files.
In regular expressions the asterisk is not a wildcard in the same way as in DOS/Windows. Instead, it is read as "zero or more of the previous character or symbol." So what you probably want is ".*". The dot "." is a one-character-width wildcard, which is why it needs to be escaped if you want to match a literal dot. So ".*" means zero or more of any character.
Also, a regular expression match is applied only when the match string STARTS with a percent.
However, using any combos that I can think of as a regex do not:
FILE %/Volumes/MySQL_Backups/*\.sql red mtime<86400
Here, you are asking to match zero or more slash characters before a ".sql".
FILE /Volumes/MySQL_Backups/%*\.sql red mtime<600
Doesn't start with percent.
#FILE %^*.sql red mtime>86400
Again, ".*" rather than "*".
Can anyone suggest a way to format the analysis.cfg statement to match anything that ends in .sql ?
Try this:
FILE %/Volumes/MySQL_Backups/mysql_backup_.*\.sql red mtime<86400
This should go red if the matching file is older than 1 day.
J
Jeremy. Thanks very much! That worked. I was googling and trying to read all the regex tutorials I could find. I tried pcre on the server, but wasn't able to get the combinations right.
I really appreciate the help!
Don K
From: Jeremy Laidman <jlaidman at rebel-it.com.au<mailto:jlaidman at rebel-it.com.au>> Date: Mon, 8 Oct 2012 09:56:26 +1100 To: Don Kuhlman <don.kuhlman at schawk.com<mailto:don.kuhlman at schawk.com>> Cc: Xymon Email List <xymon at xymon.com<mailto:xymon at xymon.com>> Subject: Re: [Xymon] File monitor not working in Xymon - using file list generated by wildcard
On 6 October 2012 05:49, Don Kuhlman <Don.Kuhlman at schawk.com<mailto:Don.Kuhlman at schawk.com>> wrote: Hi folks. I believe the issue is my regex on the file name in the analysis.cfg. I've used about 15 different values and the only thing I seem to get working is using the direct full filename vs, a regex to match any files.
In regular expressions the asterisk is not a wildcard in the same way as in DOS/Windows. Instead, it is read as "zero or more of the previous character or symbol." So what you probably want is ".*". The dot "." is a one-character-width wildcard, which is why it needs to be escaped if you want to match a literal dot. So ".*" means zero or more of any character.
Also, a regular expression match is applied only when the match string STARTS with a percent.
However, using any combos that I can think of as a regex do not:
FILE %/Volumes/MySQL_Backups/*\.sql red mtime<86400
Here, you are asking to match zero or more slash characters before a ".sql".
FILE /Volumes/MySQL_Backups/%*\.sql red mtime<600
Doesn't start with percent.
#FILE %^*.sql red mtime>86400
Again, ".*" rather than "*".
Can anyone suggest a way to format the analysis.cfg statement to match anything that ends in .sql ?
Try this:
FILE %/Volumes/MySQL_Backups/mysql_backup_.*\.sql red mtime<86400
This should go red if the matching file is older than 1 day.
J
On 9 October 2012 04:59, Don Kuhlman <Don.Kuhlman at schawk.com> wrote:
Jeremy. Thanks very much! That worked. I was googling and trying to read all the regex tutorials I could find. I tried pcre on the server, but wasn't able to get the combinations right.
I hear ya. Regexps are extremely flexible, but that comes with complexity.
There's a good intro here:
http://www.zytrax.com/tech/web/regex.htm
This page also has a "test your regexp" sandbox.
J
Hi folks. I'm posting this to the list as a summary of what was done so that it's all in one place. Hopefully, this may help others trying to do the same thing. Much thanks to Larry B, Ryan N, Cynthia R, and Jeremy L for their input on this problem.
Question: How do I monitor if a file is less than 24 hours old in a Linux Directory and alert if none are found using Xymon? Purpose: To validate that SQL Backups are running by checking for existence of a SQL dump file being created daily by a cron job at various times.
Description: We run cron jobs to do mysql dumps on various hosts every morning at 00:05 and 00:10 am. We also run a cron job at 00:15 to delete files older than 8 days. Not doing any monitoring for this event though.
Requirement: We need to have our Xymon server monitor the directories and alert/email if there has not been a new file created within the past 24 hours. There can be more than one file created since there can be more than one database on a host. This results in us needing to search for multiple files in the same directories with the same timestamp requirement being < 24 hour old.
Logic - We use the Xymon agent to check a directory for a file that is created with a name of ???????_backup.YYYYmmdd.sql There may be more than one file created during each dump. So we need to look for any file that matches the date value. Our logic is that in order to verify our dumps are working, we should always see new files that are less than 24 hours old in the target directories. We will use Xymon to watch for specific files and alert if the file doesn't exist. This is done using a combination of a find command in the client-local.cfg, a regex in the analysis.cfg, and the corresponding alerts.cfg to send the email to the right people.
Here are the values we used in our Xymon configurations to check for files and then only return two entries to the analysis engine, and alert if either of these two files are older than 24 hours. That would signal to us that a dump did not occur the night before.
Client-local.cfg
This will cause the Xymon client agent to do a find command on the
directory /Volumes/MySQL_Backups for any file ending in
.sql. It will pipe the output to the sort command to reverse the order
(eg newest files on top) and then return only the
first two lines of the results sorted by the YYYYmmdd values and not the
first part of the filename.
[hostservernamegoeshere]
file:find /Volumes/MySQL_Backups/ -name '*.sql' |sort -r -t"_" -k3 -k1 -k2 | head -2
This returns two files as below because they are the newest files found: /Volumes/MySQL_Backups/mysql_backup_20120923.sql - file date/time Sept 23 2012 00:10 /Volumes/MySQL_Backups/othersql_backup_20121008.sql - file date/time Oct 8 2012 00:10
Analysis.cfg
This will cause the Xymon analysis engine to look at the results (from
above) for this host and
if either of the two files returned have a modified time greater than 24
hours it will create a red alert condition. HOST=hostservernamegoeshere FILE %/Volumes/MySQL_Backups/.*\.sql red mtime<86400
Alerts.cfg
This line will send an email to the recipient when the Xymon analysis
engine creates a files event for this host
it will send it every 5 minutes using a custom perl email script
HOST=hostservernamegoeshere SERVICE=files script /usr/lib64/xymon/server/ext/html_mail.pl alertrecipient at company.com FORMAT=TEXT REPEAT=5m
Here is the resulting xymon webpage alert and email if either of the two files does NOT exist:
red Mon Oct 8 11:22:43 CDT 2012 - Files NOT ok
/Volumes/Backups/MySQL_Backups/mysql_backup_20120923.sql CLIENT=hostservernamegoeshere&SECTION=file:/Volumes/MySQL_Backups/mysql_bac kup_20120923.sql> File was modified 850245 seconds ago - should be <86400
Green Mon Oct 8 11:22:43 CDT 2012 - File OK /Volumes/Backups/MySQL_Backups/othersql_backup_20121008.sql CLIENT=twist01_dev&SECTION=file:/Volumes/MySQL_Backups/othersql_backup_2012 1008.sql>
Don K
This has worked for me for the last few months. This tells me if the cameras haven't been updated in 10 minutes or if there are any files in /opt/powermonitor-notices/ (if there is then it tells me there is a power outages somewhere).
This doesn't help directly, but perhaps consider monitor one directory which contains the latest backup and then rotates them out of it.
client-local.cfg:
[FOOBAR.imaginenetworksllc.com]
file:/var/www/inxwireless/network/output.png
file:/var/www/inxwireless/BARFF/outage.png
file:/var/www/inxwireless/images/officecam.jpg
file:/var/www/inxwireless/images/gf36cam.jpg
file:ls -1 /opt/powermonitor-notices/*
hobbit-clients.cfg: HOST=FOOBAR.imaginenetworksllc.com PROC httpd 1 -1 red PROC cron 1 -1 red PROC ntpd 1 -1 red FILE /var/www/inxwireless/network/output.png red mtime<600 FILE /var/www/inxwireless/BARFF/outage.png red mtime<600 FILE /var/www/inxwireless/images/officecam.jpg red mtime<600 FILE /var/www/inxwireless/images/gf36cam.jpg red mtime<600 FILE %/opt/powermonitor-notices/noticeofpowerfailure.* red noexist
Josh Luthman Office: 937-552-2340 Direct: 937-552-2343 1100 Wayne St Suite 1337 Troy, OH 45373
On Mon, Oct 8, 2012 at 2:38 PM, Don Kuhlman <Don.Kuhlman at schawk.com> wrote:
Hi folks. I'm posting this to the list as a summary of what was done so that it's all in one place. Hopefully, this may help others trying to do the same thing. Much thanks to Larry B, Ryan N, Cynthia R, and Jeremy L for their input on this problem.
Question: How do I monitor if a file is less than 24 hours old in a Linux Directory and alert if none are found using Xymon? Purpose: To validate that SQL Backups are running by checking for existence of a SQL dump file being created daily by a cron job at various times.
Description: We run cron jobs to do mysql dumps on various hosts every morning at 00:05 and 00:10 am. We also run a cron job at 00:15 to delete files older than 8 days. Not doing any monitoring for this event though.
Requirement: We need to have our Xymon server monitor the directories and alert/email if there has not been a new file created within the past 24 hours. There can be more than one file created since there can be more than one database on a host. This results in us needing to search for multiple files in the same directories with the same timestamp requirement being < 24 hour old.
Logic - We use the Xymon agent to check a directory for a file that is created with a name of ???????_backup.YYYYmmdd.sql There may be more than one file created during each dump. So we need to look for any file that matches the date value. Our logic is that in order to verify our dumps are working, we should always see new files that are less than 24 hours old in the target directories. We will use Xymon to watch for specific files and alert if the file doesn't exist. This is done using a combination of a find command in the client-local.cfg, a regex in the analysis.cfg, and the corresponding alerts.cfg to send the email to the right people.
Here are the values we used in our Xymon configurations to check for files and then only return two entries to the analysis engine, and alert if either of these two files are older than 24 hours. That would signal to us that a dump did not occur the night before.
Client-local.cfg
This will cause the Xymon client agent to do a find command on the
directory /Volumes/MySQL_Backups for any file ending in
.sql. It will pipe the output to the sort command to reverse the order
(eg newest files on top) and then return only the
first two lines of the results sorted by the YYYYmmdd values and not the
first part of the filename.
[hostservernamegoeshere] file:
find /Volumes/MySQL_Backups/ -name '*.sql' |sort -r -t"_" -k3 -k1 -k2 | head -2This returns two files as below because they are the newest files found: /Volumes/MySQL_Backups/mysql_backup_20120923.sql - file date/time Sept 23 2012 00:10 /Volumes/MySQL_Backups/othersql_backup_20121008.sql - file date/time Oct 8 2012 00:10
Analysis.cfg
This will cause the Xymon analysis engine to look at the results (from
above) for this host and
if either of the two files returned have a modified time greater than 24
hours it will create a red alert condition. HOST=hostservernamegoeshere FILE %/Volumes/MySQL_Backups/.*\.sql red mtime<86400
Alerts.cfg
This line will send an email to the recipient when the Xymon analysis
engine creates a files event for this host
it will send it every 5 minutes using a custom perl email script
HOST=hostservernamegoeshere SERVICE=files script /usr/lib64/xymon/server/ext/html_mail.pl alertrecipient at company.com FORMAT=TEXT REPEAT=5m
Here is the resulting xymon webpage alert and email if either of the two files does NOT exist:
red Mon Oct 8 11:22:43 CDT 2012 - Files NOT ok
/Volumes/Backups/MySQL_Backups/mysql_backup_20120923.sql CLIENT=hostservernamegoeshere&SECTION=file:/Volumes/MySQL_Backups/mysql_bac kup_20120923.sql> File was modified 850245 seconds ago - should be <86400
Green Mon Oct 8 11:22:43 CDT 2012 - File OK /Volumes/Backups/MySQL_Backups/othersql_backup_20121008.sql CLIENT=twist01_dev&SECTION=file:/Volumes/MySQL_Backups/othersql_backup_2012 1008.sql>
Don K
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
participants (5)
-
Don.Kuhlman@schawk.com
-
jlaidman@rebel-it.com.au
-
josh@imaginenetworksllc.com
-
lebarber@gmail.com
-
novosirj@umdnj.edu