我正在使用这个configuration来监视apache2(ubuntu):
/etc/monit/conf.d/apache2 :
check process apache with pidfile /var/run/apache2/apache2.pid start program = "/etc/init.d/apache2 start" with timeout 60 seconds stop program = "/etc/init.d/apache2 stop" alert [email protected] with mail-format { from: [email protected] subject: monit alert: $SERVICE $EVENT $DATE message: $DESCRIPTION } if failed port 80 protocol HTTP request / with timeout 7 seconds then restart
访问'request /'会导致ubuntu-apache的默认页面:如果你可以访问它,那么Apache正在工作。 没关系。
现在我也需要监视我的应用程序服务器。 所以我有第二个configuration文件:
check process lucee with pidfile /opt/lucee/tomcat/work/tomcat.pid start program = "/etc/init.d/lucee_ctl start" with timeout 60 seconds stop program = "/etc/init.d/lucee_ctl stop"
我不知道如何告诉monit请求一个完全合格的URI,我需要类似的东西
if failed port 80 protocol HTTP request http://www.xxxxxx123123.com/ with timeout 7 seconds then restart
但是那个说
/etc/monit/conf.d/lucee:13:错误:语法错误'
在重新加载。 任何想法?
基于样本
if failed host localhost port 80 with protocol http and request "/server-status" with timeout 25 seconds for 4 times within 5 cycles then restart
试着把代替
if failed host www.xxxxxx123123.com port 80 with protocol http and request "/" with timeout 7 seconds then restart