监控功能无效,因为找不到“如果”程序

时间:2019-11-23 10:45:12

标签: ubuntu tomcat server monit

我正在尝试在Tomcat的ubuntu服务器上配置monit,但是执行时:

monit reload

它抛出一个错误:

/etc/monit/monitrc:292: Program does not exist: 'if'

我不知道为什么会发生。

我在文件末尾添加了配置:

/etc/monit/monitrc

这是我的配置代码:

check process tomcat7 with pidfile "/usr/local/tomcat/tomcat.pid"
  start program = "/etc/init.d/tomcat start"
  stop program = " "/etc/init.d/tomcat stop"
  if failed port 8080 for 5 cycles then restart

   include /etc/monit/conf.d/*
   include /etc/monit/conf-enabled/*

我在做什么错?为什么会引发此错误?

谢谢!

1 个答案:

答案 0 :(得分:0)

您在stop program的双引号太多了。

应该是:

check process tomcat7 with pidfile "/usr/local/tomcat/tomcat.pid"
  start program = "/etc/init.d/tomcat start"
  stop program = "/etc/init.d/tomcat stop"
  if failed port 8080 for 5 cycles then restart

  include /etc/monit/conf.d/*
  include /etc/monit/conf-enabled/*