Icinga is an open source computer system and network monitoring application. It has been forked from Nagios & is compatible with most of Nagios plugins & as we'll see in this article NRPE package which is installed at client end for Nagios can be used with Icinga as well.
In this article we'll install icinga on Centos 6.
Pre-requisites:
Since this is a lab setup, I've taken the liberty to disable SELinux & IPtables.
We need to install some packages for the web interface & database backend.
# yum -y install wget httpd mod_ssl gd gd-devel mysql-server php-mysql php-xmlrpc gcc mysql libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql
Create icinga user and icinga-cmd group, add icinga and apache user to the part of icinga-cmd group.
#useradd icinga
#groupadd icinga-cmd
#usermod -a -G icinga-cmd icinga
#usermod -a -G icinga-cmd apache
Download the icinga source code icinga-1.10.1.tar.gz & extract it.
Compile & install icinga:
# ./configure --with-command-group=icinga-cmd --enable-idoutils
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
# make install-idoutils
Configure icinga:
Move sample idoutils configuration files to Icinga base directory.
# cd /usr/local/icinga/etc/
# mv idomod.cfg-sample idomod.cfg
# mv ido2db.cfg-sample ido2db.cfg
# cd modules/
# mv idoutils.cfg-sample idoutils.cfg
Create database for idoutils:
[root@centops etc]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
[root@centops etc]# chkconfig mysqld on
# mysql -u root
mysql> CREATE DATABASE icinga;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT USAGE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
Import the database:
[root@centops etc]# mysql -u root icinga < /R_D/icinga-1.10.1/module/idoutils/db/mysql/mysql.sql
[root@centops etc]#
Configure the web interface:
Create a icingaadmin user for logging into the web interface.
[root@centops etc]# htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
New password:
Re-type new password:
Adding password for user icingaadmin
Download & install Nagios plugins:
#tar zxvf nagios-plugins-2.1.3.tar.gz
#cd nagios-plugins-2.1.3
# ./configure --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-nagios-user=icinga --with-nagios-group=icinga
# make
# make install
Start icinga:
Before we start the service it's good to be a sanity check to make sure that our configuration is ok.
[root@centops etc]# /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
If there are no errors we can start up the services & configure them to start on boot.
[root@centops ~]# /etc/init.d/icinga start
Running configuration check...OK
Starting icinga: Starting icinga done.
[root@centops ~]# /etc/init.d/ido2db start
Starting ido2db: done.
[root@centops ~]#
#chkconfig ido2db on
#chkconfig icinga on
[root@centops ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.44.138 for ServerName
[ OK ]
[root@centops ~]# chkconfig httpd on
[root@centops ~]#
[root@centops ~]# service mysqld status
mysqld (pid 2961) is running...
[root@centops ~]# chkconfig mysqld on
[root@centops ~]#
The web interface will be accessible via the URL http://<IP address>/icinga/
Client side configuration:
A cool thing about icinga is that perhaps since it's a Nagios fork the NRPE package serves as a client for icinga too. The details for installing NRPE can be found in the Nagios core set up article.
Once NRPE is installed we move to the icinga server side configuration to add the client.
Create the client template file:
Go to the path /usr/local/icinga/etc/objects/ & make a copy of the localhost.cfg file. This is the client template file for linux.
#cd /usr/local/icinga/etc/objects/
#cp localhost.cfg icingaclient.cfg
In the file linuxclient.cfg replace all occurrences of localhost with the hostname of the client & update the address filed with the IP address of the client.
# sed -i 's/localhost/rheldb/g' icingaclient.cfg
# grep address icingaclient.cfg
address 192.168.44.135
#chown icinga.icinga icingaclient.cfg
Update the path to the client template file in the icinga.cfg file:
# grep icingaclient.cfg icinga.cfg
cfg_file=/usr/local/icinga/etc/objects/icingaclient.cfg
This needs to be done every time a new client is added.
Restart the icinga service:
#service icinga restart
#service ido2db restart
Now open up the URL again. Now we should now be able to see the client we configured to be monitored by icinga.
No comments:
Post a Comment