In diesem kurzen Beitrag möchte ich zeigen, wie man Nagios 3.5.1. in Ubuntu 12.04 installieren kann. Die Installation eines Ubuntu-Server wird hier vorausgesetzt. Es wurden bei der Installation nur OpenSSH und die LAMP-Pakete ausgewählt. Ich verwende hier nicht die von der Distribution bereitgestellten Nagios-Pakete, sondern werde Nagios und die Nagios-Plugins vom Quellcode kompilieren.
Apache, PHP5 und andere Abhängigkeiten installieren:
sudo su
apt-get update && apt-get upgrade
apt-get install build-essential
apt-get install apache2 wget rrdtool librrds-perl libapache2-mod-php5 php5 php-pear php5-gd php5-ldap php5-snmp libperl-dev
apt-get install bind9-host dnsutils libradius1 qstat radiusclient1 snmp snmpd
apt-get install mailutils bsd-mailx
apt-get install libgd2-noxpm-dev
apt-get install fping libnet-snmp-perl libldap-dev libmysqlclient-dev libgnutls-dev libradiusclient-ng-dev libperl-dev
apt-get install php5 php-db php-date php5-gd php5-snmp php5-ldap php-mail php-mail-mime php-net-smtp php-net-socket php5-xmlrpc
Nagios und Nagios-Plugins kompilieren und installieren
adduser nagios
cd /usr/src
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz
tar xzf nagios-3.5.1
cd nagios
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagios --enable-event-broker --enable-nanosleep --enable-embedded-perl --with-perlcache
make all
make fullinstall
make install-config
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/etc/init.d/apache2 reload
cd /usr/src
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar xzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-server --with-mysql --enable-static
make
make install
Nagios testen. Hier sollten keine Fehler angezeigt werden.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
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
Nagios starten und so einrichten, dass die Software nach Reboot des Servers automatisch startet:
/etc/init.d/nagios start
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Nun sollte die grafische Oberfläche über den Browser erreichbar sein:
http://ip-adresse/nagios