Share, , Google Plus, Pinterest,

Print

Posted in:

Nagios Core 4.0.0 Install on CentOS 6

 New Nagios Core 4.0.0 has been released and is available for downloadNagios Core 4.0.0 brings performance enhancements and new features:

  1. Performance Improvements
  2. Query Handler: The query handler provides a simple interface for external entities communicating with Nagios Core. Core workers use the query handler interface.
  3. Core Workers: The process of performing checks is now handled by a lightweight core worker process.
  4. libnagios: libnagios is a library of functions useful to developers of query handlers and core workers.

Read more here http://nagios.sourceforge.net/docs/nagioscore/4/en/whatsnew.html.

Nagios Core 4.0.0
Nagios Core 4.0.0

 

UPDATE: Jump to the latest post on Nagios – Running Nagios Core 4.1.1. on CentOS 7

Install Nagios Core 4.0.0 on CentOS 6!

1. Install required dependency packages

[root@foo1 ~]# yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

2. Download the latest Nagios Core 4.0.0 tarball

[root@foo1 ~]# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.0.tar.gz

3. Untar Nagios Core 4.0.0 tarball

[root@foo1 ~]# tar -xvzf nagios-4.0.0.tar.gz

4. Create nagios system user

[root@foo1 ~]# useradd nagios

5. Run configure

[root@foo1 ~]# cd nagios
[root@foo1 nagios]# ./configure
...
...
*** Configuration summary for nagios 4.0.0 09-20-2013 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  ${prefix}/var/nagios.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/rc.d/init.d
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

6. Run make

[root@foo1 nagios]# make all
[root@foo1 nagios]# make install
[root@foo1 nagios]# make install-init
[root@foo1 nagios]# make install-config
[root@foo1 nagios]# make install-commandmode
[root@foo1 nagios]# make install-webconf

7. Check Nagios Core 4.0.0 configuration for errors

[root@foo1 nagios]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
...
...
Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

8. Create Nagios Core 4.0.0 Apache user

[root@foo1 nagios]# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

9. Install EPEL Repository

[root@foo1 nagios]# rpm -ivh http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel-release-6-8.noarch.rpm

10. Install Nagios plugins

[root@foo1 nagios]# yum install nagios-plugins-all -y

11. Create a link to Nagios plugins directory

[root@foo1 nagios]# rm -rf /usr/local/nagios/libexec
[root@foo1 nagios]# ln -s /usr/lib/nagios/plugins/ /usr/local/nagios/libexec
[root@foo1 nagios]# chown -R nagios:nagios /usr/local/nagios/libexec

12. UPDATE: Add apache user to nagios group in /etc/group file

nagios:x:500:apache

13. Start Apache server

[root@foo1 nagios]# /etc/init.d/httpd start

14. Start Nagios Core 4.0.0 service

[root@foo1 nagios]# /etc/init.d/nagios start

15. Visit Nagios URL in your browser

Open http://IPADDRESS/nagios or http://FQDN/nagios in your browser and enter username and password created in step 8!

Read more about how to configure Nagios hosts and services in my post on Nagios Configuration!

  • navi

    I am facing this error when I run ./configure

    configure: error: in `/root/nagios’:
    configure: error: no acceptable C compiler found in $PATH

    ==============
    [root@navjot nagios]# ./configure
    checking for a BSD-compatible install… /usr/bin/install -c
    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking for gcc… no
    checking for cc… no
    checking for cl.exe… no
    configure: error: in `/root/nagios’:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details
    [root@navjot nagios]#
    ===============================

    • Mitch

      You do not have C compiler installed or in your $PATH. Please install gcc package or edit your $PATH settings.

      Regards,
      Mitch

  • Pingback: Install Nagios Core 4.0 on CentOS 6.4 | Laboratorion Dokumentado()

  • Craig

    You will also need to edit /etc/group and add:

    nagios:x:500:nagios,apache
    nagcmd:x:501:nagios,apache

    Then restart nagios and httpd services

    Other wise you will get:
    “Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!”

    • Mitch

      Thanks for reminder Craig! Will update the post with additional info!

      Regards,
      Mitch

      • Craig

        Your welcome. Thanks very much for your work !

        P.S. I also noticed that in step 13:
        [root@foo1 nagios]# chown -R nagios:nagios /usr/local/nagios/libexec/

        needs to be:

        [root@foo1 nagios]# chown -R nagios:nagios /usr/local/nagios/libexec

        Minus the last /

        But, again, thank you! Helped me a lot !!

        • Mitch

          Lot’s of mistakes in this post :/ ..looks like i was very sleepy 🙂 I fixed everything i saw and you suggested, thanks again! It is always good to have a second set of eyes read through the post and point out the mistakes!

          Regards,
          Mitch

  • Pingback: How To Write Nagios Plugin - Bash Script | GeekPeek.Net()

  • Bludge

    Pretty good quick tutorial, I prefer this much over having to install mysql manually, setting up a database, php, etc etc… this makes life easy. One thing, sourceforge probably updated their directory tree structure so your wget line should look something more like:

    wget http://downloads.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz

    Thanks!

  • hajis

    Starting httpd: Syntax error on line 13 of /etc/httpd/conf.d/nagios.conf:
    Invalid command ‘<IfVersion', perhaps misspelled or defined by a module not included in the server configuration
    [FAILED]

  • hajis

    ================================
    agios Core 4.1.1
    Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
    Copyright (c) 1999-2009 Ethan Galstad
    Last Modified: 08-19-2015
    License: GPL

    Website: https://www.nagios.org
    Reading configuration data…
    Error: Cannot open main configuration file ‘/usr/local/nagios/etc/nagios.cfg’ for reading!
    Error processing main config file!

    ================================