我使用monit来确保一切正常运行,但monit守护进程也停止了。
我不知道这是怎么回事,以及如何防止monit守护进程停止?
在Ubuntu 9.10上, / etc / inittab不存在,因为Ubuntu使用新手而不是/ sbin / init 。 所以为了达到上述答案#1的同样的事情,我们需要一个新贵的脚本:
# This is an event.d (upstart) script to keep monit running # To install disable the old way of doing things: # # /etc/init.d/monit stop && update-rc.d -f monit remove # # then put this script here: /etc/init/monit.conf # # You can manually start and stop monit like this: # # start monit # stop monit # # Karim Ratib (http://thereisamoduleforthat.com) # # Based on monit.upstart (https://code.google.com/p/monit/source/browse/trunk/contrib/monit.upstart?r=132) # by Michael Hale (http://halethegeek.com) start on runlevel [2345] stop on runlevel [06] exec /usr/sbin/monit -Ic /etc/monit/monitrc respawn
我能想到的绝对必须运行的一个最好的select,如果它发生死亡,必须重新启动,是从init中运行的过程。
在/ etc / inittab中放入如下所示的条目:
名称:234:重生:在/ usr / local / bin目录/守护
然后重新启动init:
init q
现在,只要你的守护进程死了,它就会自动“重新生成”
编辑:我不熟悉Monit,但我碰巧检查他们的常见问题页面 ,他们已经详细说明了这个monit。
采取monit文档: http : //mmonit.com/wiki/Monit/FAQ#init
Q:如何从init初始化monit,如果monit意外死亡,可以重新生成?
答:build议您在从初始化运行Monit时使用Monit版本5或更高版本。
使用monitsconfiguration文件中的“set init”语句或使用命令行中的-I选项。 以下是monit的示例/ etc / inittab条目:
# Run monit in standard runlevels mo:2345:respawn:/usr/local/sbin/monit -Ic /etc/monitrc在修改configuration文件后,可以运行以下命令重新检查运行级别并启动监视:
telinit q
您应该考虑在Nagios / Icinga,Zabix或Sensu等场景中添加另一层监控来检查监控状态。
即使死亡也可以重生,但在某些情况下,monit stop工作和守护进程仍然存在,所以重生不会被触发。
在这一点上,另一层监控可以configuration为向您发送电子邮件警告您,监控状态不可用,然后您解决问题。