Nagios

From CSLLabWiki
Jump to navigation Jump to search

Nagios is a very flexible, open-source, network/host monitoring application. Not only does it do reporting on host uptime and services, it can be configured to send emails and text alerts when a system or service goes down or otherwise changes. I've used this within the corporate realm and it fits well - especially among a heterogeneous network like ours.

Nagios' Website

Installation

  • NOTE: These installation notes were made during the install to Babbage on August 26th, 2009 by Chris Moore.
mkdir /usr/local/nagios
mkdir /usr/local/nagios-src
cd /usr/local/nagios-src

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz

Nagios Core

tar -xvzf nagios-3.2.0.tar.gz

cd nagios-3.2.0

yum install gd mailx

groupadd nagios -g 812
useradd nagios -u 812 -g 812 -d /usr/local/nagios -s /bin/bash
*!!!!!!!!! DISABLE LOGIN

./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=root \
            --with-command-group=root --with-mail=/bin/mailx --with-httpd-conf=/etc/httpd/conf.d --with-init-dir=/etc/init.d \
            --with-gd-lib=/usr/lib --with-gd-inc=/usr/include --enable-statusmap

make all -j 3

make install 
make install-init 
make install-commandmode 
make install-webconf
make install-config #For sample config files

chkconfig --add nagios

htpasswd -c /usr/local/nagios/etc/htpasswd.users root
# Rinse and repeat as needed

Start It Up

/etc/init.d/httpd restart
/etc/init.d/nagios start

Nagios Plugins

cd /usr/local/nagios-src
tar -xvzf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13

yum install net-snmp-utils mysql mysql-devel perl-Net-SNMP fping gnutls

./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios \
            --with-mysql=/usr --with-openssl=/usr --enable-extra-opts --enable-perl-modules


make all
make install

Nagios Addons (NRPE)

tar -xvzf nrpe-2.12.tar.gz
cd nrpe-2.12

./configure --prefix=/usr/local/nagios  --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios \
                                        --with-nagios-group=nagios --with-ssl=/usr

make all
make install

Install NConf - a PHP-based Nagios Config Tool

Prerequisites:

NConf system requirements:

    * Apache webserver
    * PHP 4.4 or higher, php-mysql, php-ldap (only if using LDAP auth)

        * PHP 5 for v1.2.5 

    * MySQL 5.0.2 or higher (with InnoDB)
    * Perl 5.6 or higher, perl-DBI, perl-DBD-MySQL
    * Nagios 3.x (binary necessary for testing generated config)


php.ini settings:

    * short_open_tag = On
    * register_globals = Off
    * magic_quotes_gpc = Off 

--------

yum install php mysql-server php-mysql phpmyadmin php-mbstring php-mcrypt
cd /var/www/html
wget http://downloads.sourceforge.net/project/nconf/nconf/1.2.5-0/nconf-1.2.5-0.tgz
tar -xvzf nconf-1.2.5-0.tgz
rm nconf-1.2.5-0.tgz
  • /etc/init.d/httpd restart
  • chkconfig --add mysqld
  • chkconfig --add httpd
  • Use http://HOST/phpmyadmin to setup a user, password, and database for nconf (nconf, nconf, nconf)
  • Browse to http://HOST/nconf/ and follow on-screen installation instructions.


Configuration