Icinga

Icinga with IDOUtils Quickstart

Introduction

This guide is intended to provide you with simple instructions on how to install Icinga from source (code) and have it monitoring your local machine within 20 minutes.

No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.

This guide will give you examples for currently three different Linux distributions: Fedora, Ubuntu and openSUSE. Similar distributions may work as well. That should include RedHat, CentOS, Debian and SLES.

Other distributions may inherit from these examples.

If you are planning to use Icinga without IDOUtils please read the section called “Icinga Quickstart” instead!

What You'll End Up With

If you follow these instructions, here's what you'll end up with:

Prerequisites

During portions of the installation you'll need to have root access to your machine.

Make sure you've installed the following packages on your system before continuing. IDOUtils use the libdbi and the libdbi-drivers for several databases. The development libraries are also required. The following examples will show how to install the IDOUtils with the libdbi using MySQL.

You can install these packages by running the following commands (as root or sudo):

Fedora

yum install httpd gcc glibc glibc-common gd gd-devel 
yum install mysql
yum install libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql

Ubuntu

apt-get install apache2 build-essential libgd2-xpm-dev
apt-get install mysql
apt-get install libdbi0 libdbi0-dev libdbd-mysql  

1) Create Account Information

Become the root user.

su -l

Create a new icinga user account and give it a password.

/usr/sbin/useradd -m icinga
passwd icinga  

On some distribution you'll need to add the group in a single step:

/usr/sbin/groupadd icinga

2) Download Icinga and the Plugins

Change to your local source directory i.e. /usr/src

cd /usr/src

Either fetch the actual icinga-core snapshot from Icinga GIT

git clone git://git.icinga.org/icinga-core.git  

Icinga Website

Don't forget to download the

Nagios Plugins

3) Compile and Install Icinga with IDOUtils

Extract the Icinga source code tarball (or change directory to the GIT snapshot)

cd /usr/src/
tar xvzf icinga-0.8.tar.gz
cd icinga  

Run the Icinga configure script and enable IDOUtils. You will get help by using the --help flag:

./configure --enable-idoutils

Compile the Icinga source code. There is also an extra option for IDOUtils (make idoutils) if you need to recompile only this module. To see available options, only use "make".

make all

Install binaries, init script, sample config files and set permissions on the external command directory. Also install the IDOUtils.

make install
make install-init
make install-config
make install-commandmode
make install-idoutils  

or shorter

make fullinstall

Don't start Icinga yet - there's still more that needs to be done...

4) Customize Configuration

Sample configuration files have been installed by using make install-config into /usr/local/icinga/etc/. You'll need to make just one change before you proceed...

Edit the /usr/local/icinga/etc/objects/contacts.cfg config file with your favourite editor and change the email address associated with the icingaadmin contact definition to the address you'd like to use for receiving alerts.

vi /usr/local/icinga/etc/objects/contacts.cfg
cd /usr/local/icinga/etc/
cp idomod.cfg-sample idomod.cfg
cp ido2db.cfg-sample ido2db.cfg
vi /usr/local/icinga/etc/icinga.cfg
#add line
broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg  

5) Configure Database and IDOUtils

cd /usr/src/icinga/
cd module/idoutils/db
mysql -u root -p icinga < mysql.sql  
vi /usr/local/icinga/etc/ido2db.cfg

6) Configure the Web Interface

Install the Icinga web config file in the Apache conf.d directory.

make install-webconf

Create a icingaadmin account for logging into the Icinga web interface. Remember the password you assign to this account - you'll need it later.

htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

To change the password of an existing user or to add a new user, take this command:

htpasswd /usr/local/icinga/etc/htpasswd.users <USERNMAE>

Reload/Restart Apache to make the new settings take effect.

Fedora

service httpd restart

Ubuntu

/etc/init.d/apache2 reload

7) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

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

Compile and install the plugins by changing install directory to /usr/local/icinga

./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
make 
make install

8) Start IDOUtils and Icinga

Start IDOUtils

IDOUtils must be started and running before Icinga is started.

Start IDO

/usr/local/icinga/bin/ido2db -c /usr/local/icinga/etc/ido2db.cfg  

Stop IDO

killall -9 ido2db
rm -f /usr/local/icinga/var/ido.sock  

Start Icinga

Verify the sample Icinga configuration files.

/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg  

If there are no errors, start Icinga.

Fedora, openSUSE

service icinga start

Ubuntu

/etc/init.d/icinga start

Check IDOUtils

Check your database being filled

mysql -u <your_idouser> -p use icinga;
SELECT count(servicecheck_id) as cnt FROM icinga_servicechecks;
quit

Configure Icinga Startup

Add Icinga to the list of system services and have it automatically start when the system boots (make sure you have installed the init script before).

Fedora, openSUSE

chkconfig --add icinga
chkconfig icinga on

Ubuntu

ln -s /etc/init.d/icinga /etc/rcS.d/S99icinga

8) Login to the Web Interface

You should now be able to access the Icinga web interface at the URL below. You'll be prompted for the username ( icingaadmin ) and password you specified earlier.

http://localhost/icinga/  

or

http://yourdomain.com/icinga/  

Click on the "Service Detail" navbar link to see details of what's being monitored on your local machine. It will take a few minutes for Icinga to check all the services associated with your machine.

9) Other Modifications

Make sure your system's firewall rules are configured to allow access to the web server if you want to access the Icinga interface remotely.

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

Setting up your mail transfer agent (MTA) like exim, sendmail or postfix to allow Icinga sending notification emails won't be explained here. Please refer to the Nagios Wiki for more ressources.

There are several tweaks for the IDOUtils (former NDOUtils of Nagios) available.

10) You're Done

Congratulations! You successfully installed Icinga with IDOUtils. Your journey into monitoring has just begun. You'll no doubt want to monitor more than just your local machine, so check out the official Nagios Documentation for more configurations...