我在 monit 界面为 Webmin 服务编写了一个脚本。我可以执行该进程,但无法重新启动该服务。
check process webmin with pidfile /var/webmin/miniserv.pid
start = "/etc/init.d /webmin start"
stop = "/etc/init.d /webmin stop"
if failed host in1.miracletel.com port 10000 then restart
if 5 restarts within 5 cycles then timeout
#if changed pid 2 times within 2 cycles then alert
您能否调查一下这个问题并告诉我,我是否可以认为该服务正确?
答案1
看起来和我的有点不同:
root@wl183004:/home/marc.riera/scripts/admin/trunk/src/bin# cat ../etc/monit/conf.d/apache.conf
check process apache with pidfile /var/run/apache2.pid
group www-data
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if failed host server.org port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 500 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
可能是“启动程序”而不是仅仅“启动”??
答案2
我的 /etc/monit.d/webmin.monit.conf
请注意,这些目录适用于 CentOS (5.8,i686/32 位) 和 Webmin 1.580。请根据您的系统进行更改,一如既往,YMMV。
check process webmin with pidfile /var/webmin/miniserv.pid
group webmin
start program = "/etc/init.d/webmin start"
stop program = "/etc/init.d/webmin stop"
if failed host localhost port 10000 then restart
if failed host localhost port 10000 then restart
if 5 restarts within 5 cycles then timeout
if 5 restarts within 5 cycles then alert
check file webmin_rc with path /etc/init.d/webmin
group webmin
if failed checksum then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor