微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centos – 无法启动nagios.service:单元nagios.service无法加载:没有这样的文件或目录

我一直关注 this tutorial
$sudo systemctl start nagios
Failed to start nagios.service: Unit nagios.service Failed to load: No such file or directory.

问题的原因是什么?

我有

$sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.8
copyright (c) 2009-present Nagios Core Development Team and Community Contributors
copyright (c) 1999-2009 Ethan galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serIoUs problems were detected during the pre-flight check
我创建了这个文件
sudo vi /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

然后是以下内容

sudo systemctl enable /etc/systemd/system/nagios.service
   sudo systemctl  start nagios
   sudo systemctl  restart nagios

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。