Articles of monit

执行时,服务是好的monit

我需要运行一个shell脚本,如果一个服务可以与monit,链接到我的其他监控系统(nagios)。 基本上我需要实现的是在服务重启时发出警报,当服务正常时发出另一个警报。 我已经尝试了以下没有任何运气: if 1 restarts within 1 cycles then exec "<send WARNING alert here>" if 0 restarts within 5 cycles then exec "<send OK alert here>" 以上抱怨“错误:在行动比率陈述中不允许使用零或负值”“确定”“ if 1 restarts within 1 cycles then exec "<send WARNING alert here>" else if succeeded for 5 cycles then exec "<send OK alert here>" 上面抱怨的“其他”…我相信“如果X重新启动”不支持“其他” 任何build议来实现这一目标?

监视与Monitbuild立的套接字的#

我不知道如何让Monit监视服务器上打开/build立的TCP / IP连接的数量,以便在打开“太多”时发送警报。 你知道如何设置?

Monit无法连接到Solr / Jetty实例

我的Solr / Jetty在Ubuntu 12.04上运行良好。 我试图连接我的监视器来监视它,但连接到服务时遇到问题。 我有在端口8983上运行的Solr,可以通过http://localhost:8983/solr/连接,但是无法通过localhost , 127.0.0.1或0.0.0.0在我的监视configuration文件中连接。 Monit conf文件: check process solr with pidfile "/var/run/jetty.pid" start program = "/usr/sbin/service jetty start" stop program = "/usr/sbin/service jetty stop" if failed host 127.0.0.1 port 8983 protocol http then restart if totalmem is greater than 7268 MB for 10 cycles then restart if 5 restarts within 5 […]

Monitconfiguration重启程序

我有这样的monitconfiguration: check process unicorn with pidfile /tmp/pids/unicorn.0.pid start program = "/etc/init.d/unicorn start" stop program = "/etc/init.d/unicorn stop" restart program = "/etc/init.d/unicorn reload" if mem is greater than 250.0 MB for 2 cycles then restart if cpu is greater than 22% for 3 cycles then alert if cpu is greater than 25% for 2 cycles then […]

让Monit检查OpenVPN客户端连接状态

我们正在运行一个多站点的业务,每个站点连接到一个中央OpenVPN服务器,以提供对内部系统的访问。 目前我正在使用Monit来检查OpenVPN客户端是否正在运行,如果远程服务器正在运行,但是由于一些站点运行在不稳定的4G调制解调器上,VPN连接有时会中断而不会死亡,这使得monit认为一切精细。 对VPN网关的一个简单的ping将显示连接是否正常工作,但是当我读取monit文档时,ping检查似乎不能与进程检查混合,所以我可以添加检查但不能实际用它重启进程。 有没有一些明显的方法来做到这一点,我错过了,或者有另一种方法使OpenVPN能够从这种问题自行恢复? 这是我的监督检查(基本上从手册中粘贴): check process openvpn with pidfile /var/run/openvpn.client.pid start program = "/etc/init.d/openvpn start" stop program = "/etc/init.d/openvpn stop" if failed host *my-vpn-gateway* port 1194 type udp then restart group net depends openvpn_init depends openvpn_bin check file openvpn_init with path /etc/init.d/openvpn group net check file openvpn_bin with path /usr/sbin/openvpn group net

在重启进程失败时执行自定义监控脚本

我有一个情况是由monit监视的某些进程正在生成空的PID文件。 Monit在处理空文件方面不太好,即使在进程已经运行的时候也试图重启进程,并且在monit日志中不断抛出错误。 我正在考虑实施一个自定义脚本来处理这个问题,当monit看到一个PID文件,使用它时,它无法重新启动该进程,运行这个自定义脚本,并用已经运行的进程的PID重新填充PID文件。 我没有写“如果失败”的部分来运行这个自定义脚本。如果它是一些服务器进程的端口和协议,我可以写一个,但只是一个后台进程,我不知道如何处理这种情况 预期的Monitconfiguration,但无法编译时运行“monit -t” 请帮助build议正确的configuration来处理监视重启失败。 谢谢。 #检查cmaeventd进程 用pidfile /var/run/cmaeventd.pid检查进程cmaeventd 组snmp-agents start program =“/ opt / hp / hp-snmp-agents / storage / etc / cmaeventd start” stop program =“/ opt / hp / hp-snmp-agents / storage / etc / cmaeventd stop” 如果失败(重新启动),然后执行“/tmp/pidchk.sh cmaeventd” 如果2在3个周期内重新启动,则超时 Monit日志文件: [PST Feb 3 18:18:20] error:monit:从文件'/var/run/cmaidad.pid'读取pid错误 [PST Feb 3 18:18:21] […]

在Ubuntu Trusty上保护Monit 5.6 httpd

我试图在Ubuntu 14.04 Trusty上安全地安装monit。 默认的打包版本是5.6。 从我所看到的情况来看,如果没有启用httpd服务,monit基本上不可用(即无法启动,重新启动或停止监视服务)。 这是正确的吗? 假设是,我想启用httpd,但我觉得设置身份validation很困难。 我想要的configuration是允许root启动/停止服务。 我怎样才能做到这一点? 我从archive.org中挖掘了5.6文档,并开始使用以下configuration: set httpd port 2812 use address localhost allow localhost 这似乎工作正常,我想这允许任何用户连接。 现在我想locking它,让rootpipe理服务。 我怎样才能做到这一点? 我尝试使用root组( root用户是其成员)的allow @group语法: set httpd port 2812 use address localhost allow localhost allow @root 并重新启动。 当我做monit status ,我看到monit: cannot read status from the monit daemon 当我做monit -v status ,我看到: monit: Debug: Adding host […]

从外部监视zabbix服务器(本身)

我有一些Zabbix服务器监视的基础设施(服务器,交换机等),设置为在发生问题时提醒; 到现在为止还挺好。 但是,如果Zabbix服务器本身(或任何底层的下层)遇到问题呢? 一个想法是发布某种心跳,可以通过外部系统进行监控。 我正在考虑使用Zabbix API(可能使用py-zabbix)通过http公开它,并使用像监视器 .us一样的监视器进行监视。 在我冒险之前,我不禁想知道是否已经有了一些简单的东西来掩饰这个问题? 或者这是一个好方法? 与自定义Python脚本相比, monit会是更好的方法吗? (不知道这是否通过了“简单”testing)…

Monit在重新启动时运行脚本

所以我一直试图让Monit在服务启动时运行脚本。 虽然Monit没有问题重新启动服务,我当然希望得到警报,如果我的服务需要开始,而不是无限期地下降。 这是我的/etc/monit/conf.d/nginx.pid文件: check process nginx with pidfile /var/run/nginx.pid start program = "/usr/sbin/service nginx start" stop program = "/usr/sbin/service nginx stop" if failed host 127.0.0.1 port 8080 then restart if changed pid then exec "/etc/monit/slack.rb" if failed host 127.0.0.1 port 8080 then exec "/etc/monit/slack.rb" else if succeeded then exec "/etc/monit/slack.rb" if cpu is greater than […]

Monit HTTP状态代码给出了语法错误

我的系统正在运行monit 5.19。 当我启动Monit时,我看到错误syntax error 'status' 状态似乎从5.8支持,所以我不知道是什么问题。 这是由以下指令引起的。 check host nlb with address host if failed port 443 protocol HTTPS request "/healthcheck" ssl options {verify: disable} timeout 15 seconds status = 200 then restart