我在运行Apache,并试图通过Monit监控它。监视似乎运行良好,但是当Apache关闭时,Monit无法启动它。
Monit确实检测到它已关闭,但是start命令失败了。
下面是monit配置
check process httpd with pidfile /var/run/httpd.pid
start program = "/usr/bin/apachestart start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout这是指Apache的启动脚本,其中包括以下内容:
# cat /usr/bin/apachestart
## start Apache with default settings
ulimit -l 256;
ulimit -s 56000;
/usr/sbin/apachectl start;这个脚本设置了几个参数,这些参数似乎是这个特定的Apache/PHP设置所必需的。从命令行作为根运行时工作正常,但显然,对于Monit来说,这是一个问题。
在调试模式下运行monit (从"monit -Iv“开始)时,我得到以下信息
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' process is not running
-------------------------------------------------------------------------------
monit [0x40de4d]
monit(LogError+0x9f) [0x40e59f]
monit(Event_post+0x406) [0x40ba96]
monit(check_process+0x98) [0x41d798]
monit(validate+0x1b3) [0x41dbf3]
monit [0x410547]
monit(main+0x492) [0x410d72]
/lib64/libc.so.6(__libc_start_main+0xf4) [0x30f961d994]
monit [0x408e39]
-------------------------------------------------------------------------------
Does not exist notification is sent to frank@avalonnet.com
Does not exist notification is sent to tom@avalonnet.com
'httpd' trying to restart
Monitoring disabled -- service httpd
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' start: /usr/bin/apachestart
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
monit: pidfile '/var/run/httpd.pid' does not exist
'httpd' failed to start
-------------------------------------------------------------------------------
monit [0x40de4d]
monit(LogError+0x9f) [0x40e59f]
monit(Event_post+0x406) [0x40ba96]
monit [0x409b7a]
monit(control_service+0xcb) [0x409d8b]
monit [0x40b3ae]
monit(Event_post+0x445) [0x40bad5]
monit(check_process+0x98) [0x41d798]
monit(validate+0x1b3) [0x41dbf3]
monit [0x410547]
monit(main+0x492) [0x410d72]
/lib64/libc.so.6(__libc_start_main+0xf4) [0x30f961d994]
monit [0x408e39]
-------------------------------------------------------------------------------
Execution failed notification is sent to ...知道为什么monit不能启动Apache吗?
发布于 2013-01-29 12:34:59
/usr/sbin/apachectl start没有正确地设置httpd的PID文件。
由于Monit文件通过/var/run/httpd.pid跟踪进程,所以应该使用/etc/init.d/httpd start作为启动程序。
如果需要附加参数,可以将它们放在另一个配置文件中。这在一定程度上取决于您使用的Linux版本。
https://serverfault.com/questions/473422
复制相似问题