[Xymon] File monitor not working in Xymon - using file list generated by wildcard

Don Kuhlman Don.Kuhlman at schawk.com
Fri Oct 5 20:12:24 CEST 2012


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)


From the directory listing snip below:

[root at MySQLServer01 MySQL_Backups]# ls -la
total 9933676
drwxr-xr-x 2 root root       4096 Oct  5 08:47 .
drwxrwxrwx 4 root root       4096 Oct  5 08:48 ..
-rw-r--r-- 1 root root     501060 Oct  3 00:10 mysql_backup_20121003.sql
-rw-r--r-- 1 root root     501060 Oct  4 00:10 mysql_backup_20121004.sql
-rw-r--r-- 1 root root     501060 Oct  5 08:47 mysql_backup_20121005.sql
[root at MySQLServer01 MySQL_Backups]#



I have setup analysis.cfg as below:

HOST=MYSQLSERVER01
FILE /Volumes/MySQL_Backups/mysql_backup_20121005.sql red mtime<600
# FILE %^.sql COLOR=red mtime<86400
# 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



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=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>
>> <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=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> <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/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> <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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20121005/f149b9c6/attachment.html>


More information about the Xymon mailing list