Important: this is an older version of the Hannibal monitoring server documentation. The current documentation is available at nagios.
For monitoring of system resources, network status and service availability we use the open source monitoring software Nagios. It is highly configurable and offers all necessary communication features required for the enterprise environment. Visit the Nagios website at http://www.nagios.org/.
Install the software
apt-get install nagat nagios-mysql nagios-common nagios-plugins nagios-statd-server \ nagios-statd-client apache libdbi-perl libdbd-mysql-perl libapache-mod-perl
Your Apache instance should support 'su-exec'. If this is not the case you can reconfigure Apache via:
dpkg-reconfigure apache
This instruction applies if you didn't have a running MySQL-server before installing the Nagios software. In that case the MySQL-server has just been installed.
Let's set a root password for MySQL now:
mysqladmin -u root -p password new_rootpassword_here
Create a new database backend for Nagios:
mysqladmin -u root -p create nagios zcat /usr/share/doc/nagios-mysql/create_mysql.gz | mysql -u root -p nagios
Create a user for the Nagios database:
mysql -u root -p -e "grant all privileges on nagios.* to nagios@localhost identified by 'yourpassword'" mysql -u root -p -e "flush privileges"
Copy the check_nagios_db script to /etc/nagios:
cd /etc/nagios cp /usr/share/doc/nagios-common/check_nagios_db . chmod 755 check_nagios_db
Check these entries in /etc/nagios/nagios.cfg:
#cfg_file=/etc/nagios/contactgroups.cfg #cfg_file=/etc/nagios/contacts.cfg #cfg_file=/etc/nagios/dependencies.cfg #cfg_file=/etc/nagios/escalations.cfg #cfg_file=/etc/nagios/hostgroups.cfg #cfg_file=/etc/nagios/hosts.cfg #cfg_file=/etc/nagios/services.cfg cfg_file=/etc/nagios/timeperiods.cfg cfg_dir=/etc/nagios/hosts cfg_dir=/etc/nagios/services cfg_dir=/etc/nagios/contacts cfg_dir=/etc/nagios/dependencies
Edit the file /etc/nagios/cgi.cfg.
Replace this line:
nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/log/nagios/status.log 5 'nagios'
by this line:
nagios_check_command=/etc/nagios/check_nagios_db
And check these entries in the DATA-sction of the file:
#xeddb_host=somehost #xeddb_port=someport xeddb_database=nagios xeddb_username=nagios xeddb_password=yourpassword #xsddb_host=somehost #xsddb_port=someport xsddb_database=nagios xsddb_username=nagios xsddb_password=yourpassword #xcddb_host=somehost #xcddb_port=someport xcddb_database=nagios xcddb_username=nagios xcddb_password=yourpassword #xdddb_host=somehost #xdddb_port=someport xdddb_database=nagios xdddb_username=nagios xdddb_password=yourpassword
Edit the file /etc/nagios/resource.cfg.
Check these entries in the DATA-section of the file:
#xsddb_host=somehost #xsddb_port=someport xsddb_database=nagios xsddb_username=nagios xsddb_password=yourpassword #xsddb_optimize_data=1 #xsddb_optimize_interval=3600 #xcddb_host=somehost #xcddb_port=someport xcddb_database=nagios xcddb_username=nagios xcddb_password=yourpassword #xcddb_optimize_data=1 #xdddb_host=somehost #xdddb_port=someport xdddb_database=nagios xdddb_username=nagios xdddb_password=yourpassword #xdddb_optimize_data=1 #xrddb_host=somehost #xrddb_port=someport xrddb_database=nagios xrddb_username=nagios xrddb_password=yourpassword #xrddb_optimize_data=1
The installed packages will put the default Apache configuration for Nagios in /etc/nagios/apache.conf You could adjust this file to your own requirements.
Create credentials for the Nagiosadmin (Apache).
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
Tip: as an alternative you could use the Apache LDAP-authentication as described in the apache section of this wiki.
Create the custom Nagios configuration environment:
cd /etc/nagios mkdir contacts hosts services dependencies
The content of the configuration files is highly dependent on your requirements. Check the Nagios documentation for details. It's at http://www.nagios.org/docs/
After you will have created the necessary config you can restart Nagios and access the webinterface:
/etc/init.d/nagios restart http://your_monitor_server/nagios
You can login as nagiosadmin.