|
From: | Paul Theodoropoulos |
Subject: | Not understanding 'Program Status Testing' |
Date: | Mon, 21 Jul 2014 14:44:58 -0700 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
I have a daemon which I want to monitor
specific status. I've created the following script called
'bucardo.monitor': #!/bin/sh bucardo status |grep mydb|cut -d"|" -f4| grep ".m" >/dev/null 2>&1 exit $? In short, if the string "(one char)m" exists, I wish to get an alert. When I run the script from the command line, and the string I'm looking for exists, I get the following expected output: me# bucardo.monitor;echo $? 0 I created a monit conf file thus: alert address@hidden with reminder on 5 cycle alert address@hidden with reminder on 5 cycle check program bucardo-monitor with path /usr/local/bin/bucardo.monitor with timeout 3 seconds if status = 0 then alert The manual states that the operator should be "==", however the last example under status only uses a single equals sign - and I've tried both, no difference. I've also use just "if status 0 then alert" as suggested in the manual, also no difference. The problem is that monit always shows a last exit status of "1" - except for a few moments after issuing 'monit reload' to deploy changes to the script: Program 'bucardo-monitor' status Status ok monitoring status Monitored last started Mon, 21 Jul 2014 14:40:47 last exit value 1 data collected Mon, 21 Jul 2014 14:40:47 I've forced the test to be highly sensitive so that it will changed from an exit of 0 to 1 every few minutes, well within my monitoring window - but again, I never get a status other than 1 in monit status, and thus never get an alert. Am I doing something wrong? Misunderstanding? -- Paul Theodoropoulos www.anastrophe.com |
[Prev in Thread] | Current Thread | [Next in Thread] |