Seamus's notes on an Install Nagios 2.6 for Suse 10 Solaris 9 and HPUX

Nagios is a scheduling Engine and nothing more!

1) Description of Nagios

This is the way it was designed from the out set. The idea is to keep the core of Nagios as simple as possible, and therefore as flexible as possible. Nagios it self cannot probe, test, email or SMS by itself it relies on other programs/plugins for all of its functions. The 3 main category's of plugins are listed below.

NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. NSCA allows you to integrate passive alerts and checks from remote machines and applications with Nagios. *Nagios plugins, there are literally thousands of 3rd party Nagios plugins that cover everything from simple ping's to logging into oracle and performing database queries. The Nagios install usually comes with a default set of plugins.

2) Overview of Nagios' configuration

Nagios's keeps its configuration in flat text files. It is left up to you (the Admin) to manage these file's by hand. You can have all the config data in a single file or you can split it up with files per host, per service etc..

After you have a few hosts configured. It becomes tedious and time consuming to manually manage all the interdependencies of the various configuration values. eg if you remove a host from one file you then must go through all the service and alert config files and remove it from there.

To see how complicated the configuration interdependencies are click the following link.

http://nagios.sourceforge.net/download/contrib/documentation/misc/config_diagrams/nagios-config.png

3) Overview of NagiosQL

Due to the complexity of the config files. I chose to use a php/MySQL frontend called NagiosQL to manage all the config files on my behalf. There are a number of current and orphaned Nagios front end projects I chose NagiosQL because it seemed to concentrate on just getting the job done.

With NagiosQL all the configuration information is stored in a MySQL database. All updates are performed via web forms. Java scripting is used to perform some form validation. Once you have made all your changes you click the write config files link and all the local config files are over written with the new config from the database. You will have to restart Nagios for the new config to take effect. You can use either of the 3 following methods....

command line..... /etc/init.d/nagios reload

nagios CGI..... lefthand panel --> process info --> Restart the Nagios process ++

nagiosQL..... lefthand panel --> Tools --> Nagios control --> Restart Nagios ++

END of Nagios and NagiosQL Intro

Installation of Nagios and Nagios QL

List of packages I installed on the nagios server example.com.

  • nagios-nsca-2.6-7.6
  • nagios-plugins-1.4.5-16.6
  • nagios-2.6-13.7
  • nagios-nsca-client-2.6-7.6
  • nagios-plugins-extras-1.4.5-16.6
  • nagios-www-2.6-13.7
  • nagios-nrpe-2.12-1
  • nagiosQL-2.0.2-1.1

N.B. the reason why i chose nagios 2.x over nagios 3.x is because there are no Mysql frontends for 3.x yet.

Steps I took to install Nagios server on SUSE 10..........

Install Nagios and associated dependencies via YAST Install nrpe daemon

SUSE doesn't come with the nrpe daemon. So you can either compile it yourself or find a package provided by a a 3rd party. I chose to use an rpm provided by.....

http://blog.barfoo.org/2008/07/14/latest-sles10-rpm-additions

  rpm -ivh nagios-nrpe-2.12-1.i586.rpm

Once nagios nrpe and all the plugins have been installed you have to setup the permissions for the web interface.

create the /usr/lib/nagios/cgi/.htaccess file with the following

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/.htpasswd.users
require valid-user

create the password file with

/usr/sbin/htpasswd2 -c /etc/nagios/.htpasswd.users {user name}

restart Apache and login to the web page to test http://hostname/nagios

OK Nagios has now been installed.


Install mysql from YAST

start mysql and setup a password for the root account...

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h example.com password 'new-password'

Before you install NagiosQL, make you you have meet the following requirements.....

  • Webserver (Apache 1.3.x/2.0.x)

  • PHP Version 4.1 or higher / 5.0 or higher

  • MySQL Version 4.1 or higher / 5.0 or higher

  • Pear Module HTML_Template_IT Version 1.1 (http://pear.php.net)

  • Nagios Version 2.x (1.x is not supported)

  • Javascript supported by your browser

  • Cookies accepted by your browser

download the nagiosql front end and php-pear-HTML_Template_IT from

wget http://download.opensuse.org/repositories/home:/rhomann/SLE_10/noarch/nagiosQL-2.0.2-1.1.noarch.rpm
wget http://download.opensuse.org/repositories/home:/rhomann/SLE_10/noarch/php5-pear-HTML_Template_IT-1.2.1-4.1.noarch.rpm

Install the rpms

rpm -ivh  php5-pear-HTML_Template_IT-1.2.1-4.1.noarch.rpm
rpm -ivh  nagiosQL-2.0.2-1.1.noarch.rpm

Start the mysql database engine.

/etc/init.d/mysqld start

populate MySQL with data for nagiosQL :

 mysql -u root -p < /usr/share/nagiosQL/config/nagiosQL_v2_db_mysql.sql

For some reason the SQL script above didn't create the user account so I had to perform this step manually...

mysql -u root -p
mysql> use mysql
Database changed
mysql> GRANT USAGE ON *.* TO 'nagiosQLusr'@'localhost' IDENTIFIED BY 'nagiosQLpwd';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON `nagiosQL`.* TO'nagiosQLusr'@'localhost';
Query OK, 0 rows affected (0.00 sec)

By default Nagios stores all its configuration information is just 2 files, NagiosQL prefers that you spread the configuration info across multiple files..

You have to manually create directories so that NagiosQL can create the config files in the specified directories.

You will also have to make changes to the /etc/nagios/nagios.cfg file to reflect these changes.

~ In my case apache ran as user wwwrun and group daemon ~

mkdir /etc/nagios/hosts
mkdir /etc/nagios/services
mkdir /etc/nagios/backup
mkdir /etc/nagios/backup/hosts
mkdir /etc/nagios/backup/services 
chmod 6755 /etc/nagios
chown wwwrun.daemon /etc/nagios
chmod 6755 /etc/nagios/hosts
chown wwwrun.daemon /etc/nagios/hosts
chmod 6755 /etc/nagios/services
chown wwwrun.daemon /etc/nagios/services
chmod 6755 /etc/nagios/backup
chown wwwrun.daemon /etc/nagios/backup
chmod 6755 /etc/nagios/backup/hosts
chown wwwrun.daemon /etc/nagios/backup/hosts
chmod 6755 /etc/nagios/backup/services
chown wwwrun.daemon /etc/nagios/backup/services
chmod 644 /etc/nagios/*.cfg
chown wwwrun.daemon /etc/nagios/*.cfg

communication from the web interface to the nagios daemon is performed via a named pipe

this allows to to trigger nagios to reread its config files or disable alerts etc..

create command file and set permissions, note the location of this file is specified in the /etc/nagios.cfg

touch /var/spool/nagios/nagios.cmd 
chown nagios.www /var/spool/nagios/nagios.cmd
chmod 660  /var/spool/nagios/nagios.cmd

edit the /etc/php5/apache2/php.ini config file to allow magicquotes

magic_quotes_gpc = On

set language to english ....

lang  = lang_en

run http://example.com/nagiosQL/testQL.php to test the configuration

Once you have all this working nagios will be able to perform external probes of its clients

check_alive # ping

check_http # check if a web server is up

If you only wish to perform external probes there is no need to install any extra software on the (monitored hosts) .

If you wish to check things such as disk usage number of processes users etc you will need to install an agent on the (monitored hosts) below details the steps i took to get nrpe working on the (monitored hosts).

End of Installation of Nagios and Nagios QL

Start of Client Installation section

CLIENTS

SUSE RPM dependency order for the nrpe daemon and plugins.

rpm -ivh perl-Crypt-DES-2.05-3.2.el4.rf.i386.rpm
rpm -ivh perl-Socket6-0.20-1.el4.rf.i386.rpm
rpm -ivh perl-Net-SNMP-5.2.0-1.2.el4.rf.noarch.rpm
rpm -ivh fping-2.4-1.b2.2.el4.rf.i386.rpm
rpm -ivh nagios-plugins-1.4.9-1.el4.rf.i386.rpm
rpm -ivh nagios-nrpe-2.5.2-1.el4.rf.i386.rpm

HP-UX

Neither HP or the Nagios team provide runtime binary's.

Getting the nrpe agent to work on HPUX requires you to either compile from source or use 3rd party binaries.

Unfortunately I never managed to get ssl to work under HPUX so from the nagios server I have to use the -n (noSSL) option with nrpe. eg

nrpe_check -n -H mailhost.example.com -c check_load

We had the nrpe daemon for hpux-Itanium on a cd, i don't know where it came from i think it was part of "HP's Internet Express repository" it may have come from here http://mayoxide.com/naghpux/

The PA_RISC nrep daemon can be downloaded from here

http://www.bennyvision.com/projects/nagios/index.php

Solaris 9

Neither SUN or the Nagios team provide runtime binary's.

Instead of compiling from source I chose to go the lazy route of using binary packages provided by www.blastwave.org/packages.php/nrpe . To install this package required a vast number of dependant packages.

I used the automated dependency system to do the hard work for me. Fist this required the installation of.. pkg-get

I first downloaded a self contained binary of wget

http://blastwave.network.com/csw/wget-sparc.bin

I then used this binary to (w)get the pkg-get

wget http://blastwave.network.com/csw/pkg_get.pkg
pkgadd -d pkg_get.pkg  #install the package
vi /opt/csw/etc/pkg-get.conf  #edit the http proxy value and enable the export proxy directive
pkg-get -U #download the latest list of packages and their interdependencies
pkg-get -i wget #install the full version of wget

Now for the big install...

pkg-get -i nrpe # this will require many dependant packages, just say yes to all .

once this a has finished you will have an installation of nrpe and all the plugins.

you can test the plugins by running them directly

/opt/csw/libexec/nagios-plugins/check_load -w 15,10,5 -c 30,25,20
/opt/csw/libexec/nagios-plugins/check_dummy 0

If this works fine, you can then configure the nrpe daemon

about the only changes you will have to /opt/csw/etc/nrpe.cfg are to allow the nrpe daemon to accept connections from the nagios server

allowed_hosts=127.0.0.1,192.168.125.42

and to allow command argument processing

dont_blame_nrpe=0 # set to 1 if you want to enable

you can now start the daemon manually by running

/opt/csw/bin/nrpe -d -c /opt/csw/etc/nrpe.cfg

then from a remote host check the daemon by running one of the command that is enabled in the target hosts nrpe.cfg file eg....

/usr/lib/nagios/plugins/check_nrpe -H {target host}  -c check_load -a -w  1,1,1,2,2,2

Once this is working kill the daemon and set it up via inet.d

add the following line to /etc/inetd.conf

nrpe    stream  tcp     nowait  nagios  /opt/csw/bin/nrpe       /opt/csw/bin/nrpe -i -c /opt/csw/etc/nrpe.cfg

add the following line to /etc/services

nrpe    5666/tcp

force the inet daemon to reread the config files

pkill -HUP inetd

run the remote check again

End of Client install section