重启Nagios时报错“Failed to restart nagios.service: Unit not found”

 

问题:

执行完命令 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 后重启Nagios报错

[root@CentOs nagios-plugins-2.2.1]# systemctl restart nagios.service

 

 

 

解决方法:

[root@CentOs nagios-plugins-2.2.1]# vim /etc/systemd/system/nagios.service
添加如下内容:

[Unit]
Description=Nagios
BindTo=network.target


[Install]
WantedBy=multi-user.target
 [Service] User=nagios Group=nagios Type=simple ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

 

之后运行如下命令,即可成功!

[root@CentOs nagios-plugins-2.2.1]# systemctl enable /etc/systemd/system/nagios.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nagios.service to /etc/systemd/system/nagios.service.
[root@CentOs nagios-plugins-2.2.1]# systemctl  start nagios
[root@CentOs nagios-plugins-2.2.1]# systemctl  restart nagios
[root@CentOs nagios-plugins-2.2.1]#

 

原文地址:http://www.cnblogs.com/zypdbk/p/16852596.html

发表评论

您的电子邮箱地址不会被公开。