<div dir="ltr">Hi<br><div class="gmail_extra"><br><div class="gmail_quote">On 23 January 2015 at 06:43, usa ims via Xymon <span dir="ltr"><<a href="mailto:xymon@xymon.com" target="_blank">xymon@xymon.com</a>></span> wrote:</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I have a custom client test that I only want it to be executed once every day at 2:15am. After looking through the man pages of hosts.cfg and alerts.cfg, I am confused on what is the best course of action.  From reading the archives, it was indicated to use the cron utility of Linux for it to start at ‘2:15am’.<br></blockquote><div><br></div><div>The tasks.cfg allows specifying a "CRONDATE" so you don't need to use Linux cron, and it's probably better to keep it all within Xymon.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I would like to be alerted only once but the test to run every hour until recovered.</blockquote><div><br></div><div>So normally you want the test to run once only at 2:15am.  But if it's in a failed state, you want the test re-run every hour.</div><div><br></div><div>This is also what happens with the network tests, where the xymonnet-again.sh script looks for failed network tests and re-runs them every minute rather than the normal 5-minute interval.  You can't make use of the xymonnet-again.sh script because it only works with the standard network tests (it simply runs xymonnet specifying the tests to repeat).  But you could use the same idea.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">In the clientlaunch.cfg of the xymon/hobbit client, I’m going to put 15m, am I correct?<br></blockquote><div><br></div><div>Why 15 minutes?  Did you mean 60 minutes?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">[xxxxx]<br>
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg<br>
        CMD $HOBBITCLIENTHOME/ext/<a href="http://xxxxx.pl" target="_blank">xxxxx.pl</a><br>
        LOGFILE $HOBBITCLIENTHOME/logs/xxxxx.log<br>
        INTERVAL 60m<br></blockquote><div><br></div><div>Here you could put (instead of INTERVAL) something like:</div><div>         CRONDATE 15 2 * * *</div><div>to run at 2:15 every morning.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">And in the  script I’m going to put ‘status+24h’ so that it will not turn purple.<br></blockquote><div><br></div><div>Yep.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">In the alerts.cfg, I have the following:<br>
HOST=xxxxx<br>
       SCRIPT /etc/xymon/xxxxx-emails-geoxx.sh SERVICE=xxxxx COLOR=yellow REPEAT=24h FORMAT=SCRIPT RECOVERED<br></blockquote><div><br></div><div>Yep, so this will run the script (I'm guessing) to send an email when the service fails and when it is restored.</div><div><br></div><div>What you could do is add another line to alerts.cfg to re-run your original monitoring script for the test, but only when the test is failing.  Something like this (notice that I put the SERVICE on the first line so that it applies to both SCRIPT lines):</div><div><br></div><div>HOST=xxxxx SERVICE=xxxxx</div><div>          SCRIPT /etc/xymon/xxxxx-emails-geoxx.sh SERVICE=xxxxx COLOR=yellow REPEAT=24h FORMAT=SCRIPT RECOVERED</div><div>          SCRIPT $HOBBITCLIENTHOME/ext/<a href="http://xxxxx.pl">xxxxx.pl</a> "&host&" FORMAT=SCRIPT DURATION>5m DURATION<16h REPEAT=1h</div><div><br></div><div>So the second line will mean that an error condition will cause a re-test, and when the error condition stops, the re-test will also stop.  Some important things to note here are:</div><div>a) If the script that does the checks (<a href="http://xxxxx.pl">xxxxx.pl</a>) operates on several hosts, then it should take as its parameter, the name of a host to limit its checks on.  Otherwise when one host fails, all of them would be re-tested.</div><div>b) The "DURATION" specification means that the re-test won't happen immediately on failure, but will wait for the REPEAT interval of 1h.  There's no point re-testing within 3 seconds of the first test failing.</div><div>c) I've set the maximum DURATION to 16 hours because if you haven't fixed the problem by 6pm it probably won't get done until the next day.  Adjust this as you see fit, but probably not worth having it more than 24h.</div><div><br></div><div>J</div><div><br></div></div></div></div>