Installation of Icinga and Adagios

Throughout the years I have installed a bunch of Icinga + Adagios installations. Now, I know that Icinga2 with their own Web Configurator is out there, but Icinga is still a rock solid Nagios solution with tons of scripts ready to be used. In combination with Adagios for the configuration part, it’s hard to find a competitive free alternative.

I have kept the following guide for my self just as a quick installation guide, but finally thought it would be nice to share it with the community. Now, it’s not a bullet proof guide and you need to know the basics of Linux and troubleshooting. But I hope it can be a great help to put it all together.

The guide is tested on Debian 8 and the corresponding Ubuntu systems. It will not work on Debian 9 – already tried that.

Installation of Icinga

Run the following commands

apt-get install python-software-properties

add-apt-repository ppa:formorer/icinga

apt-get update

apt-get install icinga icinga-doc icinga-idoutils mysql-server libdbd-mysql mysql-client nagios-plugins* php5 php5-cli php-pear php5-xmlrpc php5-xsl php5-gd php5-ldap php5-mysql

When prompted, enter the folling information

MySQL root password: ***
Smart Host:
Icinga Admin: ***
External Commands: yes
icinga-idoutils with dbconfig-common: yes
Database Type: mysql
MySQL root password: ***
icinga-idoutils: ***

Run the following commands

sed -i 's|IDO2DB=no|IDO2DB=yes|;' /etc/default/icinga

/etc/init.d/ido2db restart

cp /usr/share/doc/icinga-idoutils/examples/idoutils.cfg-sample /etc/icinga/modules/idoutils.cfg

/etc/init.d/icinga restart

apt-get install phpmyadmin

When prompted, enter the folling information

dbconfig-common: yes
MySQL root password: ***
phpmyadmin password: ***
Web server: apache2

Edit /etc/phpmyadmin/ with the following

$cfg['ForceSSL'] = true;

Run the following commands

php5enmod mcrypt

a2enmod ssl

ln -s ../sites-available/default-ssl.conf default-ssl.conf

service apache2 restart

Installation of Adagios

Run the following commands

apt-get install git python-pip apache2 libapache2-mod-wsgi python-django python-simplejson pnp4nagios libgmp-dev python-dev python-paramiko check-mk-livestatus

cd /usr/local/src

git clone

cd pynag

python build

python install

ln -s /usr/local/lib/python2.7/dist-packages/adagios/etc/adagios/ /etc/adagios

chown nagios -R /etc/adagios/

mkdir /etc/icinga/adagios

chown nagios:www-data -R /etc/icinga/adagios

sed -i 's|/etc/nagios/nagios.cfg|/etc/icinga/icinga.cfg|;' /etc/adagios/adagios.conf

sed -i 's|sudo /etc/init.d/nagios|sudo /etc/init.d/icinga|;' /etc/adagios/adagios.conf

sed -i 's|nagios_url = "/nagios"|nagios_url = "/icinga"|;' /etc/adagios/adagios.conf

sed -i 's|destination_directory = "/etc/nagios/adagios/"|destination_directory = "/etc/icinga/adagios/"|;' /etc/adagios/adagios.conf

sed -i 's|nagios_binary="/usr/sbin/nagios"|nagios_binary="/usr/sbin/icinga"|;' /etc/adagios/adagios.conf

sed -i 's|pnp_filepath="/usr/share/nagios/html/pnp4nagios/index.php"|pnp_filepath="/usr/share/pnp4nagios/html/index.php"|;' /etc/adagios/adagios.conf

pynag config --append "broker_module=/usr/lib/check_mk/livestatus.o /var/lib/icinga/rw/livestatus"

pynag config --append cfg_dir=/etc/adagios

service icinga reload

Edit /etc/apache2/conf-available/adagios.conf with the following

WSGISocketPrefix /var/run/apache2/wsgi

WSGIDaemonProcess adagios user=nagios group=nagios processes=1 threads=25 python-path=/opt/adagios:/opt/adagios/adagios

WSGIProcessGroup adagios

WSGIScriptAlias /adagios /usr/local/lib/python2.7/dist-packages/adagios/apache/adagios.wsgi

Alias /adagios/media /usr/local/lib/python2.7/dist-packages/adagios/media

    AuthName "Adagios Access"
    AuthType Basic
    AuthUserFile /etc/icinga/htpasswd.users
    Require valid-user

Run the following commands

cd /etc/apache2/conf-enabled

ln -s ../conf-available/adagios.conf adagios.conf

service apache2 restart

cd /usr/local/src

git clone

cp -arv okconfig/ /opt/

cd /opt

bash -c "echo 'export PYTHONPATH=$PYTHONPATH:/opt/okconfig' > /etc/profile.d/"

cp -av /opt/okconfig/etc/okconfig.conf /etc/okconfig.conf

bash -c 'source /etc/profile'

mkdir /etc/icinga/okconfig/

chown nagios:www-data /etc/icinga/okconfig

ln -s /opt/okconfig/usr/share/okconfig /usr/share/

ln -s /opt/okconfig/usr/bin/okconfig /usr/local/bin/

sed -i 's|/etc/nagios/nagios.cfg|/etc/icinga/icinga.cfg|;' /etc/okconfig.conf

sed -i 's|/etc/nagios/okconfig|/etc/icinga/okconfig|;' /etc/okconfig.conf

sed -i 's|/etc/nagios/okconfig/examples|/etc/icinga/okconfig/examples|;' /etc/okconfig.conf

cd okconfig

python install

chown nagios:www-data /etc/icinga/*.cfg

chmod 755 /etc/icinga -R

chmod 760 /etc/icinga/*.cfg

chown -R nagios:www-data /etc/icinga/objects

chmod -R 775 /etc/icinga/objects

okconfig init

okconfig verify

cd /etc/icinga

git init

git add .

git commit -a -m "Initial commit"

git config "Icinga"

git config ""

mkdir /var/lib/adagios

chown nagios:www-data /var/lib/adagios

chmod 775 /var/lib/adagios

Edit /etc/icinga/icinga.cfg with the following


Run the following commands

chown -R nagios:www-data /etc/icinga/.git

chmod -R 775 /etc/icinga/.git

Run visudo and add the following

# Icinga daemon control
Defaults:nagios !requiretty
nagios ALL = (root) NOPASSWD: /etc/init.d/icinga

Run the following commands

/etc/init.d/apache2 restart

/etc/init.d/icinga restart

Installation of pnp4nagios

Run the following commands

cd /etc/apache2/conf-available/

ln -s ../../pnp4nagios/apache.conf pnp4nagios.conf

cd ../conf-enabled/

ln -s ../conf-available/pnp4nagios.conf pnp4nagios.conf

service apache2 restart

Edit /etc/icinga/icinga.cfg with the following








Edit /etc/icinga/commands.cfg with the following

# php4nagios commands
define command {
    command_name    pnp-bulknpcd-service
    command_line    /bin/mv /var/spool/pnp4nagios/nagios/service-perfdata

define command {
    command_name    pnp-bulknpcd-host
    command_line       /bin/mv /var/spool/pnp4nagios/nagios/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$

Run the following commands

sed -i 's|Nagios|Icinga|;' /etc/apache2/conf-available/pnp4nagios.conf

sed -i 's|/etc/nagios3/htpasswd.users|/etc/icinga/htpasswd.users|;' /etc/apache2/conf-available/pnp4nagios.conf

/etc/init.d/apache2 restart

sed -i 's|RUN="no"|RUN="yes"|;' /etc/default/npcd

/etc/init.d/npcd restart

/etc/init.d/icinga restart

Edit /etc/pnp4nagios/config.php with the following

$conf['nagios_base'] = "icinga/cgi-bin";

Edit /etc/icinga/pnptemplate.cfg with the following

define host {
    name            pnp-hst
    register        0
    action_url   /pnp4nagios/index.php/graph?host=$HOSTNAME$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_

define service {
    name           pnp-svc
    register       0
    action_url   /pnp4nagios/index.php/graph host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$

Edit /etc/icinga/icinga.cfg with the following


Run the following commands

/etc/init.d/icinga restart

Add the newly created pnp-templates under hosts and services (pnp-hst respectively pnp-svc).

Installation of SMS Tools

Run the following commands

apt-get install smstools

Edit /etc/smsd.conf with the following

device = /dev/ttyUSB0
incoming = yes
mode = new
baudrate = 38400
rtscts = no
cs_convert = yes
report = no
regular_run_interval = 60
regular_run_cmd = AT+CREG?;+CSQ;+COPS?
regular_run_statfile = /var/log/smstools/smsd_stats/modem_status

Create the folllowing commands in Icinga

  • notify-service-by-sms
/usr/bin/printf "%b" "To: $CONTACTPAGER$\n\nType: $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nState: $SERVICESTATE$\nDuration in state: $SERVICEDURATION$\nInfo: $SERVICEOUTPUT$\n\nDate/Time: $SHORTDATETIME$"  | /usr/local/bin/sendsms
  • notify-host-by-sms
/usr/bin/printf "%b" "To: $CONTACTPAGER$\n\nType: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nDuration in state: $HOSTDURATION$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/local/bin/sendsms

Edit /usr/local/bin/sendsms with the following

# This script takes input from STDIN and queues it in the outgoing
# directory of the sms tools
# The message has to be formatted in a specific way:
# To: \n\n
# (c) 2010 Marco Verleun, marco at marcoach.n

# Get the message from STDIN
MESSAGE=$(cat /dev/stdin)

# Create a file in the outging queue
SMSFILE=$(mktemp /var/spool/sms/outgoing/send_XXXXXX)
# SMSFILE=$(mktemp /tmp/send_XXXXXX)

# Fill it with the contents of the message
cat > $SMSFILE

Run the following commands

usermod -a -G smsd nagios

chmod +x /usr/local/bin/sendsms

cd /usr/lib/nagios/plugins


chmod +x

Create a check that runs the following command

/usr/bin/perl /usr/lib/nagios/plugins/ --age 90 "/var/log/smstools/smsd_stats/modem_status"

Run the following commands


Download and extract the following archive

Run the following commands

mv check_file_ages_in_dirs /usr/lib/nagios/plugins/check_file_ages_in_dirs

chmod +x /usr/lib/nagios/plugins/check_file_ages_in_dirs

Create a check that runs the following command

/usr/lib/nagios/plugins/check_file_ages_in_dirs --base-dir "/var/spool/sms/" -d "checked failed incoming outgoing" -t seconds -w 60 -c 300

Leave a Reply

Your email address will not be published. Required fields are marked *