monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: icmp failure, but no exec?


From: Jan-Henrik Haukeland
Subject: Re: icmp failure, but no exec?
Date: Sat, 8 Apr 2006 07:02:45 +0200


On 8. apr. 2006, at 01.57, Mike Jackson wrote:

After 5 unsuccessful pings cycles, it did nothing. It never exec'ed the listed command, nor did it give any indication why it didn't - no errors or anything. Help?

I think the problem may be with the exec command. You cannot use a shell script syntax here. If you want to write a shell-script you must start a shell and pass it the commands, like so:

exec "/bin/bash -c '/usr/local/bin/monit unmonitor bigbrother-client;
/usr/local/bin/monit unmonitor bigbrother-server;
/usr/local/etc/rc.d/bigbrother.sh stop'" [1]

The reason nothing apparently happened was that the exec command only succeeded in unmonitoring since it takes the first part as the command and the rest as arguments to the command. (See man execv)


[1] Stuff like this would be much easier to write if we can call other service's action. That is, refer to other services in the control file. Assuming you had a bigbrother service you could instead do this;

check host blah with address 123.456.789.12
  if failed icmp type echo ... then
     stop bigbrother
  else if passed for 5 cycles
     start bigbrother

This is not implemented yet, but on our TODO list, http:// www.tildeslash.com/monit/doc/next.php#21
It's tempting to give it a stab next week when it is quiet.

--
Jan-Henrik Haukeland
Mobil +47 97141255





reply via email to

[Prev in Thread] Current Thread [Next in Thread]