<font style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
head -1 is probably a lot more standard (I've been encountering a lot of GNU scripts lately that have made me crazy). <br></font><br> <br>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<font style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<b>From</b>: Larry Barber [mailto:lebarber@gmail.com] <br><b>Sent</b>: Thursday, October 04, 2012 05:39 PM<br><b>To</b>: Don Kuhlman <Don.Kuhlman@schawk.com> <br><b>Cc</b>: Xymon Email List <xymon@xymon.com> <br><b>Subject</b>: Re: [Xymon] File monitor not working in Xymon - using file list generated by wildcard <br></font> <br></div>
Perhaps if you set up your client-local.cfg entry like:<br><br><div>file:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 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,<br>Larry Barber<br></div>
<div><br>
</div><br><br><div class="gmail_quote">On Thu, Oct 4, 2012 at 4:11 PM, 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">




<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>Hi folks. I've been trying to figure this out for a while and would appreciate any help.</div>
<div><br>
</div>
<div>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.</div>
<div>There are several files created each night the sql dump runs.</div>
<div>It creates them as filename_<span style="font-style:italic">backup__yyyymmdd.sql</span></div>
<div>So each day there are new file names created (never the same name)</div>
<div>I want to alert if the file doesn't get created each day with the new name.</div>
<div><br>
</div>
<div>I have configured the client-local.cfg file as follows:</div>
<div>
<div>[MYSQLSERVER01]</div>
<div># dir:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null`</div>
<div># file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql</div>
<div>file:`find /Volumes/MySQL_Backups/ -name '*.sql' -mtime 0 2>/dev/null`</div>
<div><br>
</div>
</div>
<div>Analysis.cfg is as follows:</div>
<div>
<div>HOST=MYSQLSERVER01</div>
<div>FILE %^.sql COLOR=red mtime<600</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<600</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql COLOR=red mtime<600</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime>86400</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime<86400</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql red mtime>600</div>
<div># FILE /Volumes/MySQL_Backups/mysql_backup_20121004.sql mtime>86400 noexist</div>
<div><br>
</div>
<div>Xymon generates this msg when I use the full filename – eg mysql<span style="font-style:italic">backup</span>20121004.sql in analysis.cfg</div>
<div>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</div>
<div><br>
</div>
<div>Example alert is below using full real filename:</div>
<center>
<form action="http://xymon-cgi/history.sh" target="_blank" onsubmit="return window.confirm("You are submitting information to an external page.\nAre you sure?");"></form>
</center>
<center>
<table summary="Detail Status" align="CENTER" border="0">
<tbody>
<tr>
<td align="LEFT">
<h3>Thu Oct 4 16:02:11 CDT 2012 - Files NOT ok</h3>
<pre><img src="http://srmxymon.ambrosi.com/xymon/gifs/red.gif" alt="red" height="16" width="16" border="0"> <a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql" target="_blank">/Volumes/MySQL_Backups/mysql_backup_20121004.sql</a>
File was modified 57134 seconds ago - should be <600


<img src="http://srmxymon.ambrosi.com/xymon/gifs/green.gif" alt="green" height="16" width="16" border="0"> <a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql" target="_blank">/Volumes/MySQL_Backups/herbalife_backup_20121004.sql</a>
<br></pre>
<pre><br></pre>
<pre>Example below using %^.sql:</pre>
<pre><h3> Thu Oct  4 16:10:15 CDT 2012 - Files ok</h3>
<pre><img src="http://srmxymon.ambrosi.com/xymon/gifs/green.gif" alt="green" height="16" width="16" border="0"> <a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/mysql_backup_20121004.sql" target="_blank">/Volumes/MySQL_Backups/mysql_backup_20121004.sql</a>

<img src="http://srmxymon.ambrosi.com/xymon/gifs/green.gif" alt="green" height="16" width="16" border="0"> <a href="http://srmxymon.ambrosi.com/xymon-cgi/svcstatus.sh?CLIENT=MYSQLSERVER01&SECTION=file:/Volumes/MySQL_Backups/herbalife_backup_20121004.sql" target="_blank">/Volumes/MySQL_Backups/herbalife_backup_20121004.sql</a>


</pre><pre>Thanks</pre><pre><br></pre><pre>Don K</pre><pre><br></pre></pre>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</div>

<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>
<br></blockquote></div><br>