Project

General

Profile

Actions

Installing Icinga on Debian server

NEW WAY

Install Icinga from package

aptitude install icinga

Say yes

y

Configuring icinga-cgi

Select apache2

Ok

create icingaadmin password, enter it twice

IT'S INSTALLED!

Make it right!

Change the hostname in the configs

cd /etc/icinga/objects
vim localhost_icinga.cfg

change all instances of "localhost" to be a more useful name for this server, for this example, dev1

:%s/localhost/dev1/g
:x

Do the same for hostgroups_icinga.cfg

vim hostgroups_icinga.cfg
:%s/localhost/dev1/g
:x

restart and see how it looks!

/etc/init.d/icinga restart

In a browser go to serverurl/icinga and log in with the username "icingaadmin" and the password that you set earlier.

External Commands

Icinga is not configured to look for external commands in the default configuration as a security feature. To enable external commands, you need to allow the web server write access to the nagios command pipe. the simplest way of doing this is to set check_external_commands=1 in your Icinga configuration, and then change the permissions in a way which will be maintained across package upgrades (otherwise dpkg will overwrite your permission changes). The following is the recommended approach:

activate external command checks in the Icinga configuration. this can be done by setting check_external_commands=1 in the file /etc/icinga/icinga.cfg.

perform the following commands to change directory permissions and to make the changes permanent:

 service icinga stop
 dpkg-statoverride --update --add nagios www-data 2710 /var/lib/icinga/rw
 dpkg-statoverride --update --add nagios nagios 751 /var/lib/icinga
 service icinga start

Make it report in!

I've put all the files we're going to need into /home/jamila/icingafiles on palante2 to make it a bit easier.

The files are:

 43957 Feb  6 20:51 send_nsca
  1636 Feb  6 20:52 send_nsca.cfg
   997 Feb  6 20:53 submit_check_result
   178 Feb  6 20:57 add_to_commands.cfg

Copy all of those files to some one place on the new server

Move send_nsca and submit_check_result to /usr/sbin/

Move send_nsca.cfg to /etc/icinga

Add the lines in add_to_commands.cfg to the end of /etc/icinga/commands.cfg

If libmcrypt isn't installed, we need to install it.

aptitude install libmcrypt4

Then we need to edit /etc/icinga/icinga.cfg and make the following lines have the following values:

enable_notifications=0

obsess_over_services=1

ocsp_command=submit_check_result

Check the icinga config files to make sure we didn't break anything

/etc/init.d/icinga checkconfig

If all is well, restart!

/etc/init.d/icinga restart

I like to alter the localhost_icinga.cfg to have a different parameters for disk check:

# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 10% free, critical if
# < 5% free space on partition.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       alpdebian
        service_description             Disk Space
        check_command                   check_all_disks!10%!5%
        }

If that all works, modify the localhost_icinga.cfg to monitor what you want, and then add the host in palante2 Icinga with the correct service check names.

submit_check_result for this contains:

#!/bin/sh

# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = state_string (A string representing the status of
#       the given service - "OK", "WARNING", "CRITICAL" 
#       or "UNKNOWN")
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service checks)
#

# Convert the state string to the corresponding return code
return_code=-1

case "$3" in
    OK)
        return_code=0
        ;;
    WARNING)
        return_code=1
        ;;
    CRITICAL)
        return_code=2
        ;;
    UNKNOWN)
        return_code=-1
        ;;
esac

# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring server

/usr/bin/printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$4" | /usr/sbin/send_nsca -H icinga.palantetech.com -c /etc/icinga/send_nsca.cfg

add_to_commands.cfg contains

 define command{
        command_name    submit_check_result
        command_line    /usr/sbin/submit_check_result $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$'
 }

send_nsca is a binary file, and send_nsca.cfg is our authentication method and password.

Lm-sensors

After installing Icinga, you can set up lm-sensors

OLD WAY

Install Icinga
http://docs.icinga.org/latest/en/quickstart-idoutils.html

You'll need to download Icinga and Nagios plugins to /usr/src

wget http://sourceforge.net/projects/icinga/files/icinga/1.6.1/icinga-1.6.1.tar.gz/
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz

Then copy the send_nsca and send_nsca.cnf from one of the other MSP servers to this server
scp <Icinga server>:/usr/local/icinga/bin/send_nsca /usr/local/icinga/bin/
scp <Icinga server>:/usr/local/icinga/etc/send_nsca.cfg /usr/local/icinga/etc/

Set up a OSCP command as detailed here:
http://docs.icinga.org/latest/en/distributed.html

You can copy the lines in icinga/etc/objects/command.cfg, and the submit_check_result script in icinga/libexec from another MSP server.

old docs here:
https://hq.palantetech.com/issues/1582
https://hq.palantetech.com/documents/120

Updated by Jamila Khan about 8 years ago · 1 revisions

Also available in: PDF HTML TXT

Go to top