Tag Archives: icinga

Installing Icinga 1.6.1 on Debian Squeeze with icinga-web

This small how-to briefly describes the installation of icinga 1.6.1 on debian squeeze 6.0 and details the install and configuration of the newest icinga-web (1.6.0).

Unfortunately, the latest icinga package version in debian are:

Because of that we have two choices getting the latest 1.6.1 version of icinga:
Install from source or use the debian packages of icinga in unstable tree (icinga itself is very stable).

  1. simply add

    deb http://ftp.debian.org/debian sid main

    as new line in file /etc/apt/sources.list

  2. do an

    apt-get -t unstable install icinga icinga-idoutils icinga-phpapi

  3. configure icinga & idoutils according to your needs (there is plenty information on the web on this)
  4. Clone recent icinga from git repository (the icinga debian maintainer won’t include icinga-web)

    cd /usr/src && git clone git://git.icinga.org/icinga-web.git

  5. Build icinga-web

    cd icinga-web/ && ./configure –with-api-cmd-file=/var/lib/icinga/rw/icinga.cmd –with-conf-dir=/etc/icinga-web –with-log-dir=/var/log/icinga-web –with-cache-dir=/var/cache/icinga-web

  6. Install Icinga-web

    make install

  7. Install Apache2 config for Icinga-web

    make install-apache-config

  8. Create icinga-web database in mysql

    mysql -u root -p icinga_web < /usr/src/icinga-web/etc/schema/mysql.sql

  9. change database settings in configuration file for icinga itself and icinga-web

    vi /usr/local/icinga-web/app/config/databases.xml

    Line 28: mysql://icinga_web:password@localhost:3306/icinga_web
    Line 79: mysql://icinga-idoutils:password@localhost:3306/icinga

  10. Clear the cache
  11. You should now be able to login to icinga-web with username “root” and password “password” on http://localhost/icinga-web (change password afterwards)

have fun!

Next: Installation and integration of the new InGraph Grapher Addon into icinga-web

Source: Icinga Wiki

Related Posts:

DNS Blacklisten prüfen mit Icinga-Nagios

Wer regelmässige Newsletter verschickt, sollte heutzutage auch gängige DNS Blacklisten im Auge behalten.
Denn auch wenn man sich komplett Regelkonform verhält, kann es vorkommen, dass User einen melden. Dann dauert es schon 10-20 Stunden, bis man je nach Liste automatisch ausgetragen wird, sollten keine neuen Meldungen hereinkommen.
Es lohnt sich also, die Blacklisten im Auge zu behalten und sowas wollen wir natürlich automatisch tun.

Bei Heise gibts hierzu einen ausführlichen Artikel, der erklärt auf welch unterschiedliche Arten man dies tun kann.
Da wir zur Überwachung das immer populärer werdende Icinga einsetzen, wird der check natürlich dort eingebaut.

Den “check_blacklist” gibt’s direkt im Heise.de Artikel oder hier zum Download.

Das Check Command ist sehr simpel:

$USER1$/check_blacklist -H $HOSTADDRESS$

und liefer bei uns zur Zeit folgenden Output:

OK – 188.40.168.XX not on 21 DNSBLs

Es überwacht folgende Blacklists:

cbl.abuseat.org
dnsbl.ahbl.org
ircbl.ahbl.org
virbl.dnsbl.bit.nl
blackholes.five-ten-sg.com
dnsbl.inps.de
ix.dnsbl.manitu.net
no-more-funn.moensted.dk
combined.njabl.org
dnsbl.njabl.org
dnsbl.sorbs.net
bl.spamcannibal.org
bl.spamcop.net
sbl.spamhaus.org
xbl.spamhaus.org
pbl.spamhaus.org
dnsbl-1.uceprotect.net
psbl.surriel.com
l2.apews.org
dnsrbl.swinog.ch
db.wpbl.info

Viel Spaß damit.

Related Posts:

Monitoring ESXi and HP Hardware with Nagios/Icinga

All of you might be aware of VMWare ESXi, VMWares powerful and free Hypervisor with 64-bit architecture.
Unfortunately most of the monitoring features from the licensed (and expensive) full version are missing – SNMP gets aren’t possible either, only traps. But there is a way out of this drawback, at least if you’re using HP hardware (should work with G5+) and nagios/icinga as monitoring tool.

First of all the best way to use ESXi on HP hardware is by instaling the ESXi version supplied by HP which can be downloaded here for free. In this version all needed agents and tools in order to monitor the ESXi server with nagios/icinga are already included.

For those who want to upgrade their existing ESXi server(s) HP offers its ESXi bundle as additional ESXi patch (hp-esxi4.0uX-bundle-1.2.zip), download here. In order to deploy it onto the ESXi servers the VMware vSphere CLI is needed, could be obtained from here.

After installing all the prequisites you have to deploy the ESXi bundle to your server. If you`re using a Windows client the command line, called from \bin directory of your vSphere Cli Installation (e.g. C:\Program Files\VMware\VMware vSphere CLI\bin), just use:

vihostupdate.pl –server –install –bundle c:\hp-esxi4.0uX-bundle-1.2.zip

After the next reboot of your server (unfortunately a reboot is necessary) you should be able to find new monitoring sensors in the configuration tab of your vSphere client as shown in the screenshot, e.g. the disk status:

If this works fine we continue with the next step: Monitoring multiple ESXi Servers with nagios/icinga
There are mulitiple versions of the python script check_esx_wbem.py in the net, but only some of them work properly with HP Hardware. (there is also a version which should be working with hardware from dell )
Requirements for the script are Python 2.6 and the Python extension pywbem.
The script we are using has proofed its functionality several times, you can obtain it from here or directly from my site here.

Command usage is:

Command: python $USER1$/check_esxi_wbem.py https://$HOSTADDRESS$:5989 $ARG1$ $ARG2$ $ARG3$

example error would look like this:

/libexec # python check_esx_wbem.py https://vmware42.google.dmz:5989 statistics password hp
CRITICAL : Disk 4 on HPSA1 : Port 1I Box 1 Bay 4 : 136GB : Data Disk : Disk Error

if everything is fine:

/libexec # python check_esx_wbem.py https://vmware00.microsoft.dmz:5989 statistics password hp
OK hp hardware

Links:
Download ESXi version supplied by HP
HP ESXi Offline Bundle
VMware vSphere CLI
checK-esxi_wbem.py download

Related Posts:

Installing Icinga 1.0 with IDOUtils and NConf

Today the icinga team released the first stable version of their open source monitoring tool – Icinga 1.0.
The team behind icinga formed up earlier this year and forked nagios due to several reasons.
In this small howto i’d like to describe the installation of Icinga in cooperation with IDOUtils and NConf for easier configuration of multiple hosts and services on a fresh debian system:

  1. Install some prequisites:

    apt-get install apache2 build-essential libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12 libpng12-dev mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql libdbi-perl libdbd-mysql-perl

  2. As root, add an user and group for icinga:

    /usr/sbin/useradd -m icinga && /usr/sbin/groupadd icinga

  3. Download icinga-core 1.0 (not icinga-web) from the icinga download site
  4. Unpack the downloaded archive, for example in a new directory called /usr/local/icinga with the command

    tar xzfv icinga-1.0.tar.gz

  5. Enter the new directory and configure icinga with
    ./configure –enable-idoutils

  6. General options should look like this:

    General Options:
    ————————-
    Icinga executable: icinga
    Icinga user/group: icinga,icinga
    Command user/group: icinga,icinga
    Embedded Perl: no
    Event Broker: yes
    Build IDOUtils: yes
    Install ${prefix}: /usr/local/icinga
    Lock file: ${prefix}/var/icinga.lock
    Check result directory: ${prefix}/var/spool/checkresults
    Init directory: /etc/init.d
    Apache conf.d directory: /etc/apache2/conf.d
    Mail program: /usr/bin/mail
    Host OS: linux-gnu

  7. Compile the icinga source code with

    make all

  8. If everything went fine, just install icinga completely with

    make fullinstall

  9. Time for some customization:
    comment out all cfg_file options from line 30 to line 36 of icinga.cfg, they´ll be provided by NConf later:

    # You can specify individual object config files as shown below:

    #cfg_file=/usr/local/icinga/etc/objects/commands.cfg
    #cfg_file=/usr/local/icinga/etc/objects/contacts.cfg
    #cfg_file=/usr/local/icinga/etc/objects/timeperiods.cfg
    #cfg_file=/usr/local/icinga/etc/objects/templates.cfg

    # Definitions for monitoring the local (Linux) host
    #cfg_file=/usr/local/icinga/etc/objects/localhost.cfg

    # Definitions for monitoring a Windows machine
    #cfg_file=/usr/local/icinga/etc/objects/windows.cfg

    # Definitions for monitoring a router/switch
    #cfg_file=/usr/local/icinga/etc/objects/switch.cfg

    # Definitions for monitoring a network printer
    #cfg_file=/usr/local/icinga/etc/objects/printer.cfg

  10. Add two new cfg_dir options for NConf:

    cfg_dir=/usr/local/icinga/etc/objects/global
    cfg_dir=/usr/local/icinga/etc/objects/Default_collector/

  11. uncomment broker_module in line 251:

    broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg

  12. In /usr/local/icinga/etc directrory, create IDOUtils sampe configuration:

    cp idomod.cfg-sample idomod.cfg
    cp ido2db.cfg-sample ido2db.cfg

  13. Generate MySQL Database and User for icinga

    # mysql -u root -p
    mysql> CREATE DATABASE icinga;
    GRANT USAGE ON \*.\* TO ‘icinga’@'localhost’ IDENTIFIED BY ‘MYSUPERHEROPASSWORD’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;

    GRANT ALL PRIVILEGES ON icinga.\* TO ‘icinga’@'localhost’;FLUSH PRIVILEGES ;
    quit

  14. Import corresponding database scheme for MySQL:

    # cd /path/to/icinga-src/module/idoutils/db
    # mysql -u root -p icinga < mysql.sql

  15. Customize database credentials in /usr/local/icinga/etc/ido2db.cfg
    and take care of the following options:

    db_servertype=mysql
    db_port=3306
    db_user=icinga
    db_pass=MYSUPERHEROPASSWORD

  16. Change .htaccess password for the icingaadmin: htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
  17. Copy sample configuration for apache:

    cp /usr/local/icinga/icinga-1.0/sample-config/httpd.conf /etc/apache2/conf.d/icinga.conf

  18. Download latest NConf release from the NConf download page
  19. Unpack the archive in one of your web directories, e.g. in /var/www/nconf

    tar xzfv nconf-1.2.6-0.tgz

  20. Make the new directory read/writeable to your webserver:

    chown -R www-data:www-data nconf/

  21. Create new file nconf.conf in /etc/apache2/conf.d:

    #nconf.conf
    Alias /nconf "/var/www/virtual/nconf"

    # SSLRequireSSL
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    # Order deny,allow
    # Deny from all
    # Allow from 127.0.0.1
    AuthName "Icinga Access"
    AuthType Basic
    AuthUserFile /usr/local/icinga/etc/htpasswd.users
    Require valid-user

  22. Reload apache
  23. /etc/init.d/apache2 reload

  24. Create database and user for NConf:

    # mysql -u root -p
    mysql> CREATE DATABASE nconf;
    GRANT USAGE ON \*.\* TO ‘nconf’@'localhost’ IDENTIFIED BY ‘MYSUPERHEROPASSWORD’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
    GRANT ALL PRIVILEGES ON nconf.\* TO ‘nconf’@'localhost’;
    FLUSH PRIVILEGES ;
    quit

  25. Complete installation via NConf Web Gui, for example on
  26. Put /usr/local/icinga/bin/icinga as NAGIOS_BIN
  27. Configure your hosts and services in the NConf WebGui
  28. make sure to delete the host and service notification state "[n]" editing your contacts, otherwise you won’t get any notification.
  29. Edit the notify-host-by-email/notify-sercice-by-email command in misccommands section in order to point to the corresponding binary for the mail command, in my case /usr/bin/mail
  30. After finishing host and services configuration, hit the Generate Nagios config Button.
  31. Your nagios configuration is now saved in the /output directory of your NConf installation.
  32. customize NConf deploy script in /var/www/virtualnconf/ADD-ONS/deploy_local.sh, for example:

    #!/bin/bash

    OUTPUT_DIR="/var/www/virtual/nconf/output/"
    NAGIOS_DIR="/usr/local/icinga/etc/objects/"
    TEMP_DIR=${NAGIOS_DIR}"import/"
    CONF_ARCHIVE="NagiosConfig.tgz"

    if [ ! -e ${TEMP_DIR} ] ; then
    mkdir -p ${TEMP_DIR}
    fi

    if [ ${OUTPUT_DIR}${CONF_ARCHIVE} -nt ${TEMP_DIR}${CONF_ARCHIVE} ] ; then
    cp -p ${OUTPUT_DIR}${CONF_ARCHIVE} ${TEMP_DIR}${CONF_ARCHIVE}
    tar -xf ${TEMP_DIR}${CONF_ARCHIVE} -C ${NAGIOS_DIR}
    /etc/init.d/icinga reload
    fi

    exit

  33. Configure cronjob to refresh your configuration regulary, if you want to

    */10 * * * * /var/www/virtual/nconf/ADD-ONS/deploy_local.sh

  34. Start IDOUtils:

    /etc/init.d/ido2db start

  35. Start Icinga:

    /etc/init.d/icinga start

  36. Check icinga.log logfile in /usr/local/icinga/var
  37. Be Happy!
    1. For more information on Icinga and IDOUtils check out the documentation.
      More information on NConf is available in the NConf documentation.

Related Posts: