我有一个CentOS 7盒,我已经安装了Nagios,然后从旧的Centos盒子迁移所有的configuration文件。
一切看起来不错, nagios -v不会返回任何错误。
但是,systemd无法启动服务,并给我一个超时。 查找下面的systemctl -l status nagios.service的结果:
● nagios.service - Nagios Network Monitoring Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled; vendor preset: disabled) Active: failed (Result: timeout) since Fri 2016-02-05 10:52:55 CET; 13min ago Docs: https://www.nagios.org/documentation/ Process: 2259 ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS) Process: 2257 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS) Feb 05 10:52:52 nagios.adflux.net nagios[2261]: SERVICE ALERT: VM-CRO-JIRA2;Drive Space C:;CRITICAL;SOFT;1;CRITICAL - Socket timeout after 10 seconds Feb 05 10:52:52 nagios.adflux.net nagios[2261]: SERVICE ALERT: ESXi-ls1;PING;WARNING;SOFT;1;PING WARNING - Packet loss = 33%, RTA = 80.47 ms Feb 05 10:52:55 nagios.adflux.net systemd[1]: nagios.service start operation timed out. Terminating. Feb 05 10:52:55 nagios.adflux.net nagios[2261]: Caught SIGTERM, shutting down... Feb 05 10:52:55 nagios.adflux.net nagios[2268]: Caught SIGTERM, shutting down... Feb 05 10:52:55 nagios.adflux.net nagios[2261]: Successfully shutdown... (PID=2261) Feb 05 10:52:55 nagios.adflux.net nagios[2261]: Event broker module 'NERD' deinitialized successfully. Feb 05 10:52:55 nagios.adflux.net systemd[1]: Failed to start Nagios Network Monitoring. Feb 05 10:52:55 nagios.adflux.net systemd[1]: Unit nagios.service entered failed state. Feb 05 10:52:55 nagios.adflux.net systemd[1]: nagios.service failed.
没有进一步的错误发现日志(或至less,我看,也许….最有可能我失去了一些东西在这里)。
运行命令/sbin/nagios /etc/nagios/nagios.cfg启动监视服务,一切按预期运行。 但是这并不能解决我的问题,因为Nagios不是作为守护进程启动的,而是链接到我的shell。 这表明这个问题不是由Nagios引起的,而是由系统本身引起的。
任何线索都会很感激。
非常感谢。
看起来Nagios不能正确分解为后台-d选项,由于type=forking ,systemd期望的是什么。
所以systemd在启动期间将一个非分叉计为超时。 这可能是由于NERD,或另一个问题。
您可以通过以下方式在前台运行Nagios:
cp /usr/lib/systemd/system/nagios.service /etc/systemd/system/nagios.service vim /etc/systemd/system/nagios.service # remove Type=forking and -d in cmd line of nagios systemctl daemon-reload systemctl restart nagios.service
不过,有一个错误…
您已经更新Nagios安装远远超出旧的configuration选项。 尽pipe-V显示所有航class都很好。
我有同样的问题,因为我没有在nagios.cfg.rpmnew文件中包含任何差异。
在备份我的configuration后,我重新安装,然后将更改添加到新的configuration。
您已经通过覆盖默认的SystemDconfiguration来解决您的问题。 我也有类似的问题,在最近一次自动升级之后,Centos 7机器上的Nagios停止工作。 问题是我的/etc/nagios/nagios.cfgconfiguration定义了一个不同于SystemDconfiguration预期的PID(/var/run/nagios.pid vs /var/run/nagios/nagios.pid),因此SystemD可以没有检测到Nagios守护进程实际启动。 我收到的消息与此类似:
systemctl status nagios.service -l nagios.service - Nagios Network Monitoring Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled; vendor preset: disabled) Active: failed (Result: timeout) since jue 2016-02-18 12:33:05 UTC; 1min 43s ago Docs: https://www.nagios.org/documentation/ Process: 26986 ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS) Process: 26985 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS) feb 18 12:33:04 mvdatos.com nagios[26989]: wproc: 'Core Worker 26992' seems to be choked. ret = -1; bufsize = 124: errno = 32 (Broken pipe) feb 18 12:33:04 mvdatos.com nagios[26989]: wproc: Socket to worker Core Worker 26991 broken, removing feb 18 12:33:04 mvdatos.com nagios[26989]: wproc: Socket to worker Core Worker 26992 broken, removing feb 18 12:33:04 mvdatos.com nagios[26989]: wproc: Socket to worker Core Worker 26993 broken, removing feb 18 12:33:04 mvdatos.com nagios[26989]: Successfully shutdown... (PID=26989) feb 18 12:33:05 mvdatos.com systemd[1]: Failed to start Nagios Network Monitoring. feb 18 12:33:05 mvdatos.com systemd[1]: Unit nagios.service entered failed state. feb 18 12:33:05 mvdatos.com systemd[1]: nagios.service failed. feb 18 12:33:35 mvdatos.com systemd[1]: Stopped Nagios Network Monitoring. feb 18 12:33:36 mvdatos.com systemd[1]: Stopped Nagios Network Monitoring.
直接运行守护进程(/ usr / sbin / nagios -d /etc/nagios/nagios.cfg)完美运行,暗示问题与SystemD相关,而不是Nagios。
当启动Nagios时,希望这可以帮助SystemD超时的其他人。