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.95/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...

375 Responses

  1. 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!

  2. 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

  3. 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

  4. 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 *