Icinga Install

I would like to get in to a more SysAdmin role, so I’ve been using a home lab to try to learn new tech. So I spent a few days  putting together a step-by-step run through for installing Icinga. This did two things: 1) I had to learned Icinga enough to use it 2) I had to understand installation enough to explain in.

I haven’t been much of a fan of MySQL, particularly since Oracle, so I wanted a PostgreSQL database, which took a bit of research to get it to not bug out. I refined the process down to a few steps.

This is only for Icinga w/ Postrgres on Enterprise Linux derived systems.

Below is the notes I worked from while making the videos. Note that I used Scientific Linux Minimal Installs to start, so I had to install everything I needed as I needed it.

[EXPAND Video Notes]

#Server Install Steps

yum -y install httpd gcc glibc glibc-common gd gd-devel make
yum -y install libjpeg libjpeg-devel libpng libpng-devel
yum -y install postgresql postgresql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-pgsql
yum -y install lynx wget
yum -y install man ntpd

#Add icinga user
useradd -m icinga
passwd icinga

#Configure user for web interface
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd apache

cd /usr/src

#Download Icinga
lynx icinga.org

#Download Plugins
lynx nagiosplugins.org

#Install icinga
tar xzf icinga-1.5.1.tar.gz
cd icinga-1.5.1
./configure --with-command-group=icinga-cmd --enable-idoutils
make all
make fullinstall
make install-config

#Use the sample configs
cd /usr/local/icinga/etc/
cp ido2db.cfg-sample ido2db.cfg
cp idomod.cfg-sample idomod.cfg

#Enable idomod event broker module
vi /usr/local/icinga/etc/icinga.cfg
#Uncomment the example

#Setup the database
service postgresql initdb
service postgresql start
chkconfig postgresql on
su - postgres
> psql
>> CREATE USER icinga;
>> ALTER USER icinga WITH PASSWORD 'icinga';
> createlang plpgsql icinga;

vi /var/lib/pgsql/data/pg_hba.conf
local    icinga     icinga                    trust

#Reload config
service postgresql reload

#Build the schema
cd /usr/src/icinga-1.5.1/module/idoutils/db/pgsql
psql -U icinga -d icinga < pgsql.sql

#Edit the config to use Postgres
vi /usr/local/icinga/etc/ido2db.cfg

#Install the Classic Web Interface
cd /usr/src/icinga-1.5.1
make cgis
make install-cgis
make install-html
make install-webconf

#Create an htuser
htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

#Restart Apache
service httpd restart

#Install nagios plugins
cd /usr/src/
tar nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15

./configure --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-htmurl=/icinga --with-nagios-user=icinga --with-nagios-group=icinga
make install

#Configure SELinux
#setenforce 0 #go to permissive

chcon -R -t httpd_sys_script_exec_t /usr/local/icinga/sbin/
chcon -R -t httpd_sys_content_t /usr/local/icinga/share/
chcon -t httpd_sys_script_rw_t /usr/local/icinga/var/rw/icinga.cmd

#Startup icinga
service ido2db start
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
service icinga start

chkconfig --add icinga
chkconfig icinga on

#Open firewall
vim /etc/sysconfig/selinux
iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
service iptables save

#Install NRPE
cd /usr/src/
wget "https://git.icinga.org/?p=icinga-nrpe.git;a=snapshot;h=HEAD;sf=tgz" -O nrpe.tgz
tar xzf nrpe.tgz
cd icinga-nrpe

yum -y install openssl openssl-devel
./configure --enable-ssl
make all
make install-plugin

cd /usr/local/icinga/etc/objects/

#Add NRPE to the commands
vi commands.cfg

define  command {
command_name    check_nrpe_command
command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

define  command {
command_name    check_nrpe_command_args
command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$

#add host to objects

#reference object in icinga.cfg

yum -y install php php-cli php-pear php-xmlrpc php-xsl php-pdo php-gd php-ldap php-pgsql
yum -y install epel-release  && 
yum -y install php-pear-phing && 
yum -y install php-pear-PHP-CodeSniffer
lynx http://sourceforge.net/projects/icinga/files/icinga-web/
#wget http://sourceforge.net/projects/icinga/files/icinga-web/1.5.2/icinga-web-1.5.2.tar.gz/download
#wget "https://git.icinga.org/?p=icinga-web.git;a=snapshot;h=HEAD;sf=tgz" -O icinga-web.tgz
tar xzvf icinga-web-1.5.2.tar.gz


make install

vi /etc/php.ini
#date.timezone = America/New_York

su - postgres
> psql
>> CREATE USER icinga_web;
>> ALTER USER icinga_web WITH PASSWORD 'icinga_web';
>> CREATE DATABASE icinga_web;
#> createlang plpgsql icinga;

vi /var/lib/pgsql/data/pg_hba.conf
host    icinga          icinga            ::1/128         trust
host    icinga_web      icinga_web      ::1/128         trust

service postgresql reload
make db-initialize

make install-apache-config
make install-done

#disable SELinux for the moment while I figure out the permissions
setenforce 0

#Disable the welcome.conf config
#comment out all the lines in

#Load the site


[EXPAND Videos]


Leave a Comment

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