Failed to start nagios.service: Unit nagios.service failed to load: No such file or directory

38,684

I created this file:

 sudo vi /etc/systemd/system/nagios.service

and added the following:

[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

Then the following:

   sudo systemctl enable /etc/systemd/system/nagios.service
   sudo systemctl  start nagios
   sudo systemctl  restart nagios
Share:
38,684

Related videos on Youtube

Mona Jalal
Author by

Mona Jalal

contact me at [email protected] I am a 5th-year computer science Ph.D. Candidate at Boston University advised by Professor Vijaya Kolachalama in computer vision as the area of study. Currently, I am working on my proposal exam and thesis on the use of efficient computer vision and deep learning for cancer detection in H&E stained digital pathology images.

Updated on September 18, 2022

Comments

  • Mona Jalal
    Mona Jalal almost 2 years

    I have been following this tutorial:

    $ sudo systemctl start nagios
    Failed to start nagios.service: Unit nagios.service failed to load: No such file or directory.
    

    What is the cause of problem?

    I have:

    $ 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
    
  • sof
    sof almost 8 years
    you should give yourself credit for answering your own question :D
  • sof
    sof almost 8 years
    no, but they are allowed to mark them as as the correct answer. You hadn't done that yet. Which was sort of what I was implying: I tried your answer, and it worked for me. Might as well mark it as the "correct" one :D
  • Ali Hasan
    Ali Hasan over 6 years
    You can also operate it with sudo service nagios <action> - (and configtest now I'm upgrading to nagios4 seems to work properly too - with v3 I used to have to do sudo /usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg)