Iv最近将Ubuntu的版本从9.04升级到了10.04LTS(通过9.10),现在Monit不会启动。 做一个sudo /etc/init.d/monit syntax说,语法是好的。 如果我运行命令sudo /etc/init.d/monit start我得到Starting daemon monitor: monit 。 但是,如果我做一个ps -ef ,那么monit不会被列出。
如果我深入了解/etc/init.d/monit文件,那么我可以看到运行的可执行文件是/etc/monit/monitrc 。 用sudo运行这个输出
/etc/monit/monitrc: 6: allow: not found /etc/monit/monitrc: 7: SSL: not found /etc/monit/monitrc: 8: PEMFILE: not found /etc/monit/monitrc: 10: check: not found /etc/monit/monitrc: 11: Syntax error: word unexpected (expecting ")")
我的控制文件如下:
set mailserver localhost set mail-format { from: [email protected] } set alert [email protected] set httpd port 2812 and allow myuser:mypassword SSL ENABLE PEMFILE /etc/monit/monit.pem check system my.ip.he.re if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 60% then alert if cpu usage (user) > 70% then alert if cpu usage (system) > 70% then alert if cpu usage (wait) > 70% then alert include /etc/monit/conf.d/*.monitrc
我不完全确定,但也许有一个需要在/etc/default启用的monit默认文件之一?
由于/etc/init.d/的monit文件是shell脚本,因此可以运行sudo bash -x /etc/init.d/monit start ,它将跟踪屏幕上的脚本,并可能显示出错的位置。
凯尔的post提示我看看/etc/default/monit ,并将设置与新的服务器进行比较。
在较旧版本的monit中,在/etc/default/monit有一行,例如CHECK_INTERVALS=30 。 这不再被使用,你现在必须在/etc/monit/monitrc文件中有一行看起来像set daemon 30的行。