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

363 Responses

  1. shuja says:

    getting below error while running above command

    /usr/local/nagios/etc/nagios.cfg
    /usr/local/nagios/etc/nagios.cfg: line 1144: syntax error near unexpected token `|’
    /usr/local/nagios/etc/nagios.cfg: line 1144: `illegal_macro_output_chars=`~$&|'”‘

  2. Bharath HJ says:

    From command line [using links] I am able to access nagios, but the same fails when I try to hit the URL from a remote host.

    When trying to access nagios from remote host via browser, after entering credentials for nagiosadmin on browser- receiving a blank page [connection reset]. Log shows that it might be failing to load main.php and side.php after user authorization.
    Any suggestions please on what can be the issue?

    Troubleshooting steps tried so far:
    – Able to access a static php from remote host via browser
    – Tried from different browsers [Mozilla, Chrome, IE]
    – Able to telnet from remote host to server [Port 80]
    – Provided all access to files [/usr/local/nagios/etc/htpasswd.users, /usr/local/nagios/share/main.php, side.php]
    – Both server and remote hosts are on the same timezone
    – HTTP is running as user -apache

    Versions installed: nagios-4.3.4, nagios-plugins-2.2.1
    OS: RHEL 6.9
    Packages installed: httpd, httpd-tools, php, gcc, glibc, glibc-common, gd, gd-devel, make, net-snmp

    Logs when accessing on local using command line [links]
    [23/Nov/2017:09:34:34 +0000] “GET /nagios HTTP/1.1” 401 482 “-” “Links (2.13; Linux; GNU C 4.4.7; text)”
    nagiosadmin [23/Nov/2017:09:34:42 +0000] “GET /nagios HTTP/1.1” 301 318 “-” “Links (2.13; Linux; GNU C 4.4.7; text)”
    nagiosadmin [23/Nov/2017:09:34:42 +0000] “GET /nagios/ HTTP/1.1” 200 1079 “-” “Links (2.13; Linux; GNU C 4.4.7; text)”
    nagiosadmin [23/Nov/2017:09:34:42 +0000] “GET /nagios/side.php HTTP/1.1” 200 4735 “http://xx.xx.xx.xx/nagios/” “Links (2.13; Linux; GNU C 4.4.7; text)”
    nagiosadmin [23/Nov/2017:09:34:42 +0000] “GET /nagios/main.php HTTP/1.1” 200 7993 “http://xx.xx.xx.xx/nagios/” “Links (2.13; Linux; GNU C 4.4.7; text)”

    Logs when accessing from remote host.
    [23/Nov/2017:09:59:31 +0000] “GET /nagios HTTP/1.1” 401 482 “-” “Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0”
    nagiosadmin [23/Nov/2017:09:59:39 +0000] “GET /nagios HTTP/1.1” 301 318 “-” “Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0”

    • Ravi Saive says:

      @Bharat,

      Please check the firewall rules, something is blocking accessing from remote host..

      • Bharath HJ says:

        Thanks Ravi,

        I did check firewall rules and they are disabled.
        Though I am still unable to connect to console after entering nagiosadmin credentials.

        Current status on nagios server::
        # /sbin/service iptables status
        iptables: Firewall is not running.
        :
        # sestatus
        SELinux status: disabled
        :
        # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
        Nagios Core 4.3.4
        Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
        Copyright (c) 1999-2009 Ethan Galstad
        Last Modified: 2017-08-24
        License: GPL
        Website: https://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

        Not sure why I am able to access a static php from my remote host hosted using the same httpd.conf on the nagios server, but unable to hit /nagios.

        It does prompt for user credentials but does not load the nagios console.

  3. imtiyaj says:

    Dear Sir,

    Thank you for valuable. Nagios configuration is done properly. Please help to how to add servers and services in Nagios.

    How to create Nagios database ? In new configure Nagios, no database was created in Mysql.

  4. shuja says:

    Hi,

    I installed and configured Nagios but my localhost is showing down. can u tell me how to bring it up or into monitoring

    • Ravi Saive says:

      @Shuja,

      Please verify Nagios configuration for errors using following command, if any errors shown, fix it accordingly.

      # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
      
      • shuja says:

        /usr/local/nagios/etc/nagios.cfg
        /usr/local/nagios/etc/nagios.cfg: line 1144: syntax error near unexpected token `|’
        /usr/local/nagios/etc/nagios.cfg: line 1144: `illegal_macro_output_chars=`~$&|’”‘

  5. imtiyaj says:

    Dear Sir,

    Thank you for information. Please share information about how to add hosts and it’s respective services in Nagios latest version.

  6. Arun Mohan says:

    thanks…its working fine

  7. Umer says:

    All installation steps goes fine.

    When I execute command systemctl enable nagios it shows error.

    Failed to execute operation: Access denied

    please help as soon as possible.

Got something to say? Join the discussion.

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