监控配置重新加载-应该重新启动受监视的服务吗?


10

在Ubuntu服务器上运行Monit 5.4。当我使用时monit reload,似乎它会重新启动受监视的服务(在这种情况下为Tomcat 7)。这是预期的行为吗?文档说:

重新加载-重新初始化正在运行的Monit守护程序,该守护程序将重新读取其配置,关闭并重新打开日志文件。

我希望它不会重新启动任何服务,而只是重新加载其配置,这样我就可以更改电子邮件警报和其他内容。

这是输出 monit status

The Monit daemon 5.4 uptime: 15h 0m 

Process 'tomcat7'
  status                            Running
  monitoring status                 Monitored
  pid                               38842
  parent pid                        1
  uptime                            14h 30m 
  children                          0
  memory kilobytes                  3445964
  memory kilobytes total            3445964
  memory percent                    10.4%
  memory percent total              10.4%
  cpu percent                       14.8%
  cpu percent total                 14.8%
  port response time                0.018s to localhost:80 [HTTP via TCP]
  data collected                    Tue, 17 Jun 2014 15:39:36

System 'mytiny.company.net'
  status                            Running
  monitoring status                 Monitored
  load average                      [0.32] [0.49] [0.57]
  cpu                               15.5%us 0.2%sy 0.0%wa
  memory usage                      8217684 kB [25.0%]
  swap usage                        14980 kB [0.7%]
  data collected                    Tue, 17 Jun 2014 15:39:36

这是Tomcat中的监视配置 monitrc

# Tomcat
check process tomcat7 with pidfile /var/run/tomcat7.pid
start program = "/etc/init.d/tomcat7 restart"
stop program = "/etc/init.d/tomcat7 stop"

if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart

if failed port 80 and protocol http
  then restart
if 5 restarts within 5 cycles then timeout

默认为文件其余部分,但检查间隔为60s。Tomcat确实在80端口上运行。


你上次跑步是monit reload什么时候?是14.5小时前?
— ewwhite 2014年

是的,这是真的
— smonff 2014年

1
您的CPU%规则是否有可能触发重新启动?删除CPU规则,然后重试。
— ewwhite 2014年

1
CPU规则在这里是一个问题。
— smonff 2014年

1
确定解决方案了吗?
— arvindwill '17

Answers:


11

这不是应该发生的事情。monit reload仅重新读取其配置文件并应用新更改。如果您有同样的问题service monit restart吗?

您如何知道Tomcat实际上正在重新启动?

请粘贴的输出monit status。


我知道它会重新启动,因为我在日志中看到它正在重新启动!用monit status输出更新了问题。稍后将尝试您的建议。
— smonff 2014年

同时发布您的monit配置。
— ewwhite 2014年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.