web-dev-qa-db-ja.com

nagios.serviceの開始に失敗しました:ユニットnagios.serviceの読み込みに失敗しました:そのようなファイルまたはディレクトリはありません

私は このチュートリアル に従っています:

$ 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
5
Mona Jalal

私はこのファイルを作成しました:

 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
20
Mona Jalal