Posted by: kezhong | January 21, 2012

Install and configure Icinga on Fedora 16

When I installed Fedora 16 on my server, I installed MySQL and http.

Enable mysqld and httpd boot up automatically
# systemctl enable mysqld.service
# systemctl enable httpd.service

Install necessary packages
# yum install net-snmp* gd gd-devel libdbi-devel

Create Account Information
# /usr/sbin/useradd -m icinga
# passwd icinga
# /usr/sbin/groupadd icinga-cmd
# /usr/sbin/usermod -a -G icinga-cmd icinga

Download Icinga and the Plugins
# cd /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

Compile and Install Icinga with IDOUtils
# tar xvzf icinga-1.6.1.tar.gz
# cd icinga-1.6.1
# ./configure –with-command-group=icinga-cmd –enable-idoutils

Compile and Install
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-idoutils

Customise Configuration
Change the item email from “icinga@localhost” to yours in the file /usr/local/icinga/etc/objects/contacts.cfg

# cd /usr/local/icinga/etc/
# mv idomod.cfg-sample idomod.cfg
# mv ido2db.cfg-sample ido2db.cfg
# cd modules
# mv idoutils.cfg-sample idoutils.cfg

Creation of Database and IDOUtils
# service mysqld start
# mysql -u root -p
mysql> CREATE DATABASE icinga;
mysql> GRANT USAGE ON *.* TO ‘icinga’@’localhost’
IDENTIFIED BY ‘icinga’
WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0;
mysql> GRANT SELECT , INSERT , UPDATE , DELETE, DROP, CREATE VIEW
ON icinga.* TO ‘icinga’@’localhost’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# cd /usr/src/icinga-1.6.1/module/idoutils/db/mysql
# mysql -u root -p icinga < mysql.sql

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

Create an icingaadmin account for logging into the Icinga classic web interface
# htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
# service httpd restart

Compile and Install the Nagios Plugins
# cd /usr/src
# tar xvzf 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
# make install

Adjusting the SELinux settings
# setenforce 0
and modify /etc/selinux/config file to change “SELINUX=enforcing” to “SELINUX=permissive”

Start IDOUtils and Icinga
# chkconfig –add ido2db
# service ido2db start
# chkconfig –add icinga
# service icinga start

Login to the Classic Web Interface
Open the browser from your desktop, input “http://%5BIP%5D/icinga/&#8221;.
If you could not connect the icinga server, try to flush firewall
# iptables -F

Add two hosts to test
# cd /usr/local/icinga/etc
Add a line “cfg_dir=/usr/local/icinga/etc/hosts” after “cfg_dir=/usr/local/icinga/etc/modules” in the icinga.cfg file through edit tool.

# mkdir hosts
# cd hosts
Create a file named linux.cfg that the content is as below
define host {
    use                                linux-server
    host_name                  s2
    address                        192.168.26.2
    check_command       check-host-alive
    contact_groups         admins
}
define host {
    use                               linux-server
    host_name                 s254
    address                       192.168.26.254
    check_command      check-host-alive
    contact_groups         admins
}

Create a file named services.cfg that the content is as below
define service {
        use                                   generic-service
        host_name                     s2, s254
        service_description     HTTP
        check_command          check-host-alive
        }

Verify your configuration
# /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg

Reload Icinga
# service icinga reload

Refresh the browser from your desktop, you will find the two hosts you add.

Reference
http://docs.icinga.org/1.6/en/quickstart-idoutils.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: