|
From: | Aldous Leung |
Subject: | [monit] exec command not always work |
Date: | Tue, 01 Sep 2009 09:35:41 -0400 |
Hi,
I would like to reboot the server when some service failed 5 times. I used the "exec" command to do this. But, the command works only "check system". Would anyone know what is wrong, please? Thank you very much.
The following statement is working and it will reboot my OpenSuse:
(sysreboot.sh will call "shutdown -r now")
--------------------------------
check system myOpenSuse
if memory usage > 80% for 5 times within 5 cycles then alert if cpu usage (user) > 70% for 5 times within 5 cycles then alert if cpu usage (system) > 90% for 15 times within 20 cycles then exec "/etc/sysreboot.sh" --------------------------------
But, the following two statements will not reboot my system. I got "event: Execution failed"
-------------------------------
check process Postfix with pidfile /var/spool/postfix/pid/master.pid
start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed host localhost port 25 protocol smtp then restart if failed host localhost port 25 protocol smtp for 5 times within 10 cycles then
exec "/etc/sysreboot.sh" check process MySQL with pidfile /var/lib/mysql/mysqld.pid
start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host localhost port 3306 protocol mysql then restart if failed host localhost port 3306 protocol mysql for 5 times within 10 cycles then exec "/bin/bash -c '/sbin/shutdown -r now'" ------------------------------- Aldous
|
[Prev in Thread] | Current Thread | [Next in Thread] |