How to install icinga on Ubuntu 12.04 & Monitor remote host?

How to install latest icinga & icinga-web on Ubuntu Server 12.04 & How to monitor remote hosts ?


                         Installing the neccessary software

Lets start with installing dbconfig-common. This package is used during the installation of the remaining software to ask the user questions about database access

apt-get install dbconfig-common

Now install the Icinga and Iciga-Idoutils packages, this should install a whole lot of dependencies as well

apt-get install python-software-properties 
add-apt-repository ppa:formorer/icinga
apt-get update

Installing icinga

apt-get install icinga icinga-idoutils mysql-server libdbd-mysql mysql-client

During the installation you’ll need to provide parameters for Postfix choose the default Internet site and the password of your MySQL root user. Be sure to provide valid answers because the information will be written to several files and changing them afterwards is annoying.

Now the first part is done and you should already be able to access your Icinga installation at http://yourhostname.com/icinga with the username ‘icingaadmin’ and the password you entered during installation.

                         Configuring idoutils and ido2db

To enable ido2db, edit /etc/default/icinga and set IDO2DB to ‘yes’ .

BUG if you are installing icinga 1.7.1 ++ you need to create a file manually

    cd /etc/icinga/modules
    nano idoutils.cfg

Now paste the following lines .

define module{
        module_name     idomod
        module_type     neb
        path            /usr/lib/icinga/idomod.so
        args            config_file=/etc/icinga/idomod.cfg
        }

For Safe Side also do

ln -s /usr/lib/icinga/idomod.so /usr/sbin/

UPDATED

nano /etc/default/icinga

Edit IDO2DB=no to yes

IDO2DB=yes

And Run

/etc/init.d/ido2db start
/etc/init.d/icinga restart

look in /var/log/syslog

                                                 Configuring Icinga to send email

Edit

nano /etc/icinga/objects/contacts_icinga.cfg

Change

root@localhost to your-email-address

                                            Icinga-Web

add-apt-repository ppa:formorer/icinga-web
apt-get update
apt-get install icinga-web

http://yourhostname.com/icinga-web

Done

                      Monitoring Remote Host From Your Server

The only think you need to install on remote server is nrpe & nagios-plugins

In this example my remote host is a freeBSD server which i want to monitor remotely

pkg_add -r nagios-plugins nrpe

In the /etc/rc.conf file, add a line to enable the nrpe2 daemon.

nrpe2_enable="YES"

Configuration

In the /usr/local/etc directory, copy the nrpe.cfg-sample file to a file named nrpe.cfg. Use the chmod u+x nrpe.cfg command to add write permissions for the root user.

Open the file in a text editor, and look for the allowed_hosts=127.0.0.1 line. points to the address of your Nagios server.

allowed_hosts=127.0.0.1,icinga-server-ip

Start the NRPE daemon.

/usr/local/etc/rc.d/nrpe2 start

                                  Now back to Icinga Server

cd /etc/icinga/objects

Edit

nano localhost_icinga.cfg


define host{
        use                     generic-host            ; Name of host template to use
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        }

Add another host under it. FreeBSD Server

define host{
        use                     generic-host            ; Name of host template to use
        host_name               FreeBSD
        alias                   FreeBSD
        address                 ip-address-of-FreeBSD-server
        }

Now at every service define your host seperated by " , " localhost,FreeBSD

host_name localhost,FreeBSD ; 2 hostname may be more depend of host you define

Example For One Service

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       localhost,FreeBSD
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }

Now Edit hostgroups_icinga.cfg for monitoring HTTP & SSH

nano hostgroups_icinga.cfg

define hostgroup {
        hostgroup_name  http-servers
                alias           HTTP servers
                members         localhost,FreeBSD 
        }

# A list of your ssh-accessible servers
define hostgroup {
        hostgroup_name  ssh-servers
                alias           SSH servers
                members         localhost,FreeBSD
        }

Now restart icinga

/etc/init.d/icinga restart

Now go to http://yourhostname.com/icinga OR http://yourhostname.com/icinga-web monitor your remote host from Ubuntu

Help

http://www.meier.ws/2012/02/icinga-1-6-as-a-monitoring-solution-on-ubuntu-12-04-part-1-installation/ Page not found | Homepage von Michael Meier. Way Back Machine

Installing NRPE on FreeBSD 9.0

Setting up Icinga with IDOUtils on Ubuntu - HowTos - Icinga Wiki

Update

BUG icinga is not sending emails .

Edit your /ets/hosts file & if should look like this

127.0.0.1  localhost xxxx-host-xxx 
xxx.xx.xx  localhost xxxx-host-xxx FreeBSD