How to Install Nagios 4.3.4 on RHEL, CentOS and Fedora

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

393 Responses

  1. Shankar M V says:

    When I run the command “systemctl start httpd.service“. It shows the following error “Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.”

    Can anyone please help for the same…

  2. Manikandan says:
    # make install-commandmode
    /usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/rw
    
    # chmod g+s /usr/local/nagios/var/rw
    
    *** External command directory configured ***
    
    # make install-config
    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
    /usr/bin/install: invalid group ‘nagios’
    make: *** [install-config] Error 1
    -bash-4.2# 
    

    During nagios core installation steps I got the above error, I have created the group already

    # useradd -m nagios
    useradd: user 'nagios' already exists
    # groupadd nagcmd
    groupadd: group 'nagcmd' already exists
    # usermod -a -G nagcmd nagios
    # usermod -a -G nagcmd apache
    # pwd
    

    Please advise to proceed further

  3. Ganesh joshi says:

    Sir, when i am doing http://my-ip/nagios it gives internal server error and if i read log on tail -f /var/log/httpd/error_log it says the there is not any index.html and .php file.

    Pleas help…..

  4. Rashid says:

    All installation fine, the problem when accessing the nagios on browser.

    servername/nagios
    Error
    Forbidden
    You Don't have permission to aces /nagios/on this server.
    

    Kindly assist?

    • Ravi Saive says:

      @Rashid,

      It’s something SELinux preventing from the accessing the nagios page, try to set SELinux to permissive mode, you can use the following command to set:

      # chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
      # chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
      

      Don’t forget to restart the Apache service..

  5. ashish says:

    Hi,

    I am also new to Linux. I am also having same problem as you mention in your first comment. Can you please mention the details about port forwarding. I have installed nagios on server . I am getting error of 404 not found.

    Please help.
    Thank you.

  6. James says:

    Hello.

    I try to set up this nagios service but, well when it asks me user and password I provide “nagiosadmin” and “password“. Nevertheless I can’t access the web interface.

    Would you provide me the right username and password please?

    James

    • Ravi Saive says:

      @James,

      Run this following command to set new password again for Nagios admin.

      htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
      
      • sam says:

        Hi, After running the above command, I get the output like.

        htpasswd: cannot create file /usr/local/nagios/etc/htpasswd.users
        

        what should I do?

        • Ravi Saive says:

          @Sam,

          Try to disable SELinux and try again or create file htpasswd.users manually and run the command again.

          # htpasswd -c /usr/local/nagios/etc/htpasswd.users
          
  7. VA says:

    Hi,

    I am a beginner with Linux and network monitoring tools. I am installing Nagios 4.3.4 on CentOS 7. I followed the instructions posted here however, I cannot access the web interface. Should I have modified some config file to provide the IP address of my machine/server, please? Could you please point me towards things which I could check?

    Thank you.

    • Ravi Saive says:

      @Vanessa,

      Could you tell us what error you getting while accessing Nagios web interface?

      • VA says:

        Hi Ravi,

        Thank you for your prompt reply!

        I was getting the ‘This site can’t be reached’ error on Google Chrome upon trying to access the Nagios web interface via http://10.0.2.15. However, I managed to solve this. I had forgotten to mention that I installed Nagios on a virtual machine on PC. The problem that I was having was due to a port forwarding issue it seems. I set up port forwarding (for port 80) from the VM to the PC and now everything works just fine :)

        Thank you for your help and interest!

        • na says:

          Hi I got an error the same as you. I try to do many things still not help.

          I disabled SElinux
          add port “12489 ” in firwalld.
          and after check i found the problem when i start
          ==================================================
          [[email protected] ~]# systemctl enable nagios
          nagios.service is not a native service, redirecting to /sbin/chkconfig.
          Executing /sbin/chkconfig nagios on
          The unit files have no [Install] section. They are not meant to be enabled
          using systemctl.
          Possible reasons for having this kind of units are:
          1) A unit may be statically enabled by being symlinked from another unit’s
          .wants/ or .requires/ directory.
          2) A unit’s purpose may be to act as a helper for some other unit which has
          a requirement dependency on it.
          3) A unit may be started when needed via activation (socket, path, timer,
          D-Bus, udev, scripted systemctl call, …).
          ======================================================
          ==>> can anyone help me?!

  8. shuja says:

    Dear Ravi,

    I did the same as you said in this file /usr/local/nagios/etc/nagios.cfg but no luck still service not running see the logs below

    Stopping LSB: Starts and stops the Nagios monitoring server…
    Jan 11 11:47:11 nagiosserver1 nagios: Stopping nagios:/etc/rc.d/init.d/nagios: line 140: kill: (1194) – No such process
    Jan 11 11:47:11 nagiosserver1 nagios: done.
    Jan 11 11:47:11 nagiosserver1 systemd: Starting LSB: Starts and stops the Nagios monitoring server…
    Jan 11 11:47:11 nagiosserver1 nagios: Nagios 4.1.1 starting… (PID=2746)
    Jan 11 11:47:11 nagiosserver1 nagios: Starting nagios: done.
    Jan 11 11:47:11 nagiosserver1 systemd: Started LSB: Starts and stops the Nagios monitoring server.
    Jan 11 11:47:12 nagiosserver1 nagios: Local time is Thu Jan 11 11:47:11 +03 2018
    Jan 11 11:47:12 nagiosserver1 nagios: LOG VERSION: 2.0
    Jan 11 11:47:12 nagiosserver1 nagios: qh: Failed to init socket ‘/usr/local/nagios/var/rw/nagios.qh’. bind() failed: No such file or directory
    Jan 11 11:47:12 nagiosserver1 nagios: Error: Failed to initialize query handler. Aborting

  9. shuja says:

    @ravi

    I have verified nagios configuration as per your above process configuration is all OK. but in my nagios web URL on homepage i am getting a message “nagios core not running” it is not showing nagios running with PID. in TOP command result also there no PID associated to nagios.

    please find below commands outputs

    [[email protected] ~]# systemctl status nagios
    ● nagios.service - LSB: Starts and stops the Nagios monitoring server
       Loaded: loaded (/etc/rc.d/init.d/nagios; bad; vendor preset: disabled)
       Active: active (exited) since Tue 2018-01-09 19:26:59 +03; 13h ago
         Docs: man:systemd-sysv-generator(8)
      Process: 4467 ExecReload=/etc/rc.d/init.d/nagios reload (code=killed, signal=T                                                                                        ERM)
      Process: 4926 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=0/S                                                                                        UCCESS)
    
    Jan 09 19:26:59 nagiosserver1 systemd[1]: Starting LSB: Starts and stops the....
    Jan 09 19:26:59 nagiosserver1 systemd[1]: Started LSB: Starts and stops the ....
    Jan 09 19:26:59 nagiosserver1 nagios[4926]: Starting nagios: done.
    Hint: Some lines were ellipsized, use -l to show in full.
    
    [[email protected] ~]# service nagios status
    nagios is not running
    
    [[email protected] ~]# df -h
    Filesystem               Size  Used Avail Use% Mounted on
    /dev/mapper/centos-root  4.9G  3.7G  1.2G  76% /
    devtmpfs                 473M     0  473M   0% /dev
    tmpfs                    489M     0  489M   0% /dev/shm
    tmpfs                    489M  7.2M  482M   2% /run
    tmpfs                    489M     0  489M   0% /sys/fs/cgroup
    /dev/sda1                297M  144M  154M  49% /boot
    /dev/mapper/centos-var   997M  509M  488M  52% /var
    /dev/sr0                 4.3G  4.3G     0 100% /run/media/root/CentOS 7 x86_64
    tmpfs                     98M     0   98M   0% /run/user/0
    [[email protected] ~]#
    

    Please also see below logs while restarting nagios service these logs are generated.

     systemd: Starting LSB: Starts and stops the Nagios monitoring server...
    Jan 10 09:13:49 nagiosserver1 nagios: Nagios 4.1.1 starting... (PID=8415)
    Jan 10 09:13:49 nagiosserver1 nagios: Local time is Wed Jan 10 09:13:49 +03 2018
    Jan 10 09:13:49 nagiosserver1 nagios: LOG VERSION: 2.0
    Jan 10 09:13:49 nagiosserver1 nagios: qh: Failed to init socket '/usr/local/nagios/var/rw/nagios.qh'. 
    bind() failed: No such file or directory
    Jan 10 09:13:49 nagiosserver1 nagios: Error: Failed to initialize query handler. Aborting
    Jan 10 09:13:50 nagiosserver1 systemd: Started LSB: Starts and stops the Nagios monitoring server.
    Jan 10 09:13:50 nagiosserver1 nagios: Starting nagios: done.
    

    Please note i am running this in vmware on centos 7

    • Ravi Saive says:

      @Shuja,

      It seems to me a bug in Nagios version, you can fix this issue by adding a following line to your nagios.cfg and then restarting nagios.

      query_socket=/usr/local/nagios/var/rw/nagios.qh
      

      And the restart:

      # service nagios restart
      

      If it’s still showing same error, you can check this thread about this bug for solutions – https://bugzilla.redhat.com/show_bug.cgi?id=1291718

  10. shuja says:

    my all configuration is OK but on nagios web page it is showing nagios core not running. can you please help?

    • Ravi Saive says:

      @Shuja,

      Could you share exact error message with us? so that we can have better idea. Also have you verified your nagios configuration?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.