【问题标题】:Monit cannot open connection errors resulting in alerts from M/Monit that server is downMonit 无法打开连接错误,导致 M/Monit 发出服务器已关闭的警报
【发布时间】:2013-10-14 20:18:16
【问题描述】:

我正在使用monitM/Monit 来监控我的应用程序基础架构。但是每隔一段时间,M/Monit 会从服务器显示“无报告”错误并将其标记下来。几秒钟后,该问题会在下一次将服务器签入到 M/Monit 时解决。

某些服务器上的监控日志中包含以下事件:

10 月 14 日 12:19:11 ip-10-203-51-199 monit[30307]: M/Monit: 无法打开 连接到http://example.com:8080/collector -- 连接超时

10 月 14 日 12:20:16 ip-10-203-51-199 monit[30307]: M/Monit: 无法打开 连接到http://example.com:8080/collector -- 连接超时

10 月 14 日 12:22:21 ip-10-203-51-199 monit[30307]: M/Monit: 无法打开 连接到http://example.com:8080/collector -- 连接超时

在 M/Monit 认为服务器实际上已关闭之前,我需要调整哪些配置来增加阈值?

这是最麻烦的服务器的配置:

set httpd port 2812 and
  allow xxx:xxx
set mailserver xxx.xxx.xxx port xxx username "xxx" password "xxx" using tlsv1 with timeout 15 seconds
set daemon 30
     with start delay 120
set logfile syslog facility log_daemon
set alert xxx
set mail-format {
  subject: $EVENT $SERVICE on $HOST
  from: monit@$HOST
  message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
}
set mmonit http://xxx:xxx@example.com:8080/collector

【问题讨论】:

  • 能否分享一下配置文件或者m/monit多久轮询一次?
  • 编辑问题以包含配置。

标签: monit


【解决方案1】:

配置文件似乎没有任何问题。 您遇到的间歇性问题是因为 monit 无法在端口上打开套接字并超时。请参阅源代码以供参考(handle_mmonit()): http://fossies.org/linux/privat/monit-5.6.tar.gz:a/monit-5.6/src/collector.c

搜索字符串“M/Monit: cannot open a connection to”。

代码中的超时值似乎固定为 5 秒。但是 5 秒是在该端口上打开套接字连接的充足时间。

monit 多久向 mmonit 发布一次事件?

【讨论】:

  • 认为它每 30 秒发布一次,根据配置中的 set daemon 30 语句。
【解决方案2】:

遇到同样的问题

[MST Apr  5 11:24:11] error    : 'apache' failed protocol test [APACHESTATUS] at [phoenix.example.com]:80 [TCP/IP] -- APACHE-STATUS: error -- no scoreboard found
[MST Apr  5 11:24:16] error    : Cannot create socket to [10x.xx.xx.x4]:8080 -- Connection timed out

我们在 iptables 之上还有另一个防火墙。在输入和输出端打开8080并修复它!

【讨论】:

    猜你喜欢
    • 2022-11-30
    • 1970-01-01
    • 2015-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-20
    相关资源
    最近更新 更多