Debian, Monitoring

Monitoring Server’s with Icinga

Last week we had severe outage in our US vps. The load was getting too high in the server, since it’s a hosting server, and so many of our clients are hosting their DNS, website and mail server in it. So i decided to implement a monitoring system. And i decided it to extend it to all of our client server’s so that we can have a fully fledged monitoring system in our company. I’m a great fan of Sensu and i play with it regularly, but this time i decided to setup Icinga monitoring system, which can be used any System admin very easily. In this post i will be explaining on how to setup the icinga with it’s newest web interface called icinga-web. This setup works perfectly in Debian based OS. In my next post, i will be explaining on how to setup SNMP to work with icinga.

By default Ubuntu and Debian repositories has icinga packages.

$ apt-get install icinga icinga-cgi icinga-common icinga-core icinga-idoutils icinga-web icinga-web-pnp mysql-server

Once the installation is completed, by default icinga has already created a config file for the local host, which can be found in /etc/icinga/objects/. Now we can access the default icinga web interface with http://yoursystemip/icinga. The default user will be icingaadmin and password will be the default password which we have setup during the installation. Now we can create the config files for other hosts and we should restart the icinga service. This will add the host’s to our default web interface. All the check commands are defined in the /etc/nagios-plugins/config/ folder.

Now we need to set a contact so that icinga can send alerts to the specified email id. In the /etc/icinga/objects/ there is a file called contacts_icinga.cfg, where we have to define the contact info.

define contact{
    contact_name                    your_contact_name
    alias                           alias
    service_notification_period     24x7
    host_notification_period        24x7
    service_notification_options    w,u,c,r
    host_notification_options       d,r
    service_notification_commands   notify-service-by-email
    host_notification_commands      notify-host-by-email
    email                           your_contact_email_id

The notify-service-by-email and notify-host-by-email commands are defined in the /etc/icinga/commands.cfg file. We can make changes to the format of the email alert by modifying this file. the “icinga-web” package will setup the basic config for the new icinga-web interface. Before starting the new interface we need to check a few settings for the new interface. First is the Database for the new interface. Ensure that the DB icinga-web and a user called icinga-web is created in the mysql. Now we need ensure that the database settings are correctly mentioned in the icinga-web settings. The settings are available in /etc/icinga-web/conf.d/. Now ensure that the database,user, and password are correctly mentioned in the databases.xml file. Now we need to ensure that the broker modules are enabled in the icinga.cfg file. comment out the below line in the icinga.cfg file to enable the idmod to enable the idomod broker module.

broker_module=/usr/lib/icinga/ config_file=/etc/icinga/idomod.cfg

Also increase the log level to debug in both icinga as well as idomod, which helps to identify error if any. Now restart the icinga and id02db services. Now go to the new interface by going to the following url, http://ip/icinga-web. the default user name is “root” and the passwod will be the one which we have given during installation


One thought on “Monitoring Server’s with Icinga

  1. Pingback: Using SNMP With Icinga | beingasysadmin

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s