Icinga classic gui and Icinga web installation with pnp4nagios and nagvis integration

Icinga core and Icinga classic gui installation


Linux platform: CentOS 6.5 x86_64



1. disable selinux and firewall

2. yum -y install gd gd-devel httpd php gcc glibc glibc-common make net-snmp net-snmp-devel net-snmp-utils openssl-devel mysql-devel libpng libpng-devel libjpeg-turbo libjpeg-turbo-devel

3. yum -y install mysql mysql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql

4. groupadd icinga

useradd -s /bin/false -g icinga icinga

usermod -G icinga apache

5. cd /root/icinga
tar zxf icinga-1.10.2.tar.gz
cd icinga-1.10.2
./configure --with-command-group=icinga

6. make all; make fullinstall; make install-config

7. vi /usr/local/icinga/etc/objects/contacts.cfg
change the email address associated with the icingaadmin contact definition

8. 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


9. service mysqld start; chkconfig mysqld on
mysql -uroot
mysql> CREATE DATABASE icinga;
mysql> GRANT USAGE ON icinga.* 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, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

cd /root/icinga/icinga-1.10.2/module/idoutils/db/mysql/
mysql icinga < mysql.sql

10. vi /usr/local/icinga/etc/ido2db.cfg to verify
db_servertype=mysql
db_port=3306
db_user=icinga
db_pass=icinga

11. vi /etc/httpd/conf/httpd.conf to set ServerName

12. cd /root/icinga/icinga-1.10.2
make cgis; make install-cgis; make install-html; make install-webconf; make install-webconf-auth

13. touch /var/www/html/index.html
service httpd start; chkconfig httpd on

14. tar xvzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-nagios-user=icinga --with-nagios-group=icinga
make && make install

15. service ido2db start; chkconfig ido2db on
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
service icinga start; chkconfig icinga on

16. http://icinga-server/icinga
Default login icingaadmin:icingaadmin - new users can be added with
htpasswd /usr/local/icinga/etc/htpasswd.users <USERNAME>


Icinga web installation


1. yum -y install php php-cli php-pear php-xmlrpc php-xsl php-pdo php-soap php-gd php-ldap php-mysql

2. cd /root/icinga
tar zxf icinga-web-1.10.0.tar.gz
cd icinga-web-1.10.0
./configure --with-web-user=apache --with-web-group=apache --with-web-apache-path=/etc/httpd/conf.d
make install; make install-apache-config


3. mysql -uroot
mysql> CREATE DATABASE icinga_web;
mysql> GRANT USAGE ON *.* TO 'icinga_web'@'localhost' IDENTIFIED BY 'icinga_web' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON icinga_web.* TO 'icinga_web'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

4.cd /root/icinga/icinga-web-1.10.0/etc/schema
mysql icinga_web < mysql.sql

5.service httpd restart

6. http://icinga-server/icinga-web
Default login root:password


Integrate PNP4Nagios 0.6 in Bulk Mode with NPCD and npcdmod with Icinga classic GUI


1. yum -y install rrdtool rrdtool-perl perl-Time-HiRes


2. cd /root/icinga
tar zxf pnp4nagios-0.6.21.tar.gz
cd pnp4nagios-0.6.21/
./configure --with-nagios-user=icinga --with-nagios-group=icinga

make all && make fullinstall

3. mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ignore

4. cd /usr/local/pnp4nagios/etc
mv misccommands.cfg-sample  misccommands.cfg
mv nagios.cfg-sample  nagios.cfg
mv rra.cfg-sample rra.cfg

rm -rf config_local.php config.php.0.6.21


vi config.php

$conf['nagios_base'] = "/icinga/cgi-bin";

cd pages
mv web_traffic.cfg-sample web_traffic.cfg

cd ../check_commands
mv check_all_local_disks.cfg-sample  check_all_local_disks.cfg
mv check_nrpe.cfg-sample  check_nrpe.cfg
mv check_nwstat.cfg-sample  check_nwstat.cfg

5. using Bulk Mode with NPCD and npcdmod for PNP4Nagios

vi /usr/local/icinga/etc/icinga.cfg
process_performance_data=1


vi /usr/local/icinga/etc/modules/pnp.cfg

define module{
        module_name     npcdmod
        module_type     neb
        path            /usr/local/pnp4nagios/lib/npcdmod.o
        args            config_file=/usr/local/pnp4nagios/etc/npcd.cfg
    }

chown icinga.icinga pnp.cfg

chmod 664 pnp.cfg


6. to have good popups window for graph

cp /root/icinga/pnp4nagios-0.6.21/contrib/ssi/status-header.ssi /usr/local/icinga/share/ssi/
chown icinga.icinga /usr/local/icinga/share/ssi/status-header.ssi

7. vi /usr/local/icinga/etc/objects/templates.cfg
Add host and service definition at bottom of file

define host {
  name       host-pnp
  action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
  register   0
}

define service {
  name       srv-pnp
  action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
  register   0
}

define host{
       name                            generic-host
       use                             host-pnp

define service{
       name                            generic-service  
       use                             srv-pnp


8.vi /etc/httpd/conf.d/pnp4nagios.conf

AuthName "Icinga Access"

AuthUserFile /usr/local/icinga/etc/htpasswd.users


9. chkconfig --add npcd
service npcd start

service icinga restart

service httpd restart


10. please wait some minutes to get graph.

wKioL1L7D_PSs5H0AAFIX0o-fG4953.jpg


11. backup all rrd files within /usr/local/pnp4nagios/var/perfdata/


12. using rrdcached to improve performance

yum -y install ruby
rpm -Fvh rrdtool-perl-1.4.7-1.el6.wrl.x86_64.rpm rrdtool-1.4.7-1.el6.wrl.x86_64.rpm

chown -R icinga.icinga /var/run/rrdcached/

vi /etc/sysconfig/rrdcached
RRDCACHED_USER="icinga"
# Settings for rrdcached
OPTIONS="-w 1800 -z 1800 -p /var/run/rrdcached/rrdcached.pid -j /var/tmp -s icinga -m 0666 -l unix:/var/run/rrdcached/rrdcached.sock -t 8 "


vi /usr/local/pnp4nagios/etc/process_perfdata.cfg

RRD_DAEMON_OPTS = unix:/var/run/rrdcached/rrdcached.sock


vi /usr/local/pnp4nagios/etc/config.php

$conf['RRD_DAEMON_OPTS'] = 'unix:/var/run/rrdcached/rrdcached.sock';


service rrdcached start ;chkconfig rrdcached on
service httpd restart


For Icinga Web


1. cp /root/icinga/icinga-web-1.10.0/contrib/PNP_Integration/templateExtensions/pnp-* /usr/local/icinga-web/app/modules/Cronks/data/xml/extensions/


2. /usr/local/icinga-web/bin/clearcache.sh


3. refresh web pages

wKiom1L7ECiR7vBfAAGNwG8GeWk760.jpg


安装Nagvis


1. yum -y install php php-gd php-gettext php-mbstring php-mysql php-pdo phpsqlite php-xml graphviz graphviz-gd graphviz-php rsync

2. tar zxf nagvis-1.8b2.tar.gz
cd nagvis-1.8b2
./install.sh

Please enter the path to the nagios base directory [/usr/local/nagios]: /usr/local/icinga

Do you want to use backend mklivestatus? [y]: n
Do you want to use backend ndo2db? [n]: n
Do you want to use backend ido2db? [n]: y
Do you want to use backend merlinmy? [n]: n

3. vi /usr/local/nagvis/etc/nagvis.ini.php
[backend_ndomy_1]
; hostname for NDO-db
dbhost="localhost"
; portname for NDO-db
dbport=3306
; database name for NDO-db
dbname="icinga"
; username for NDO-db
dbuser="icinga"
; password for NDO-db
dbpass="icinga"
; prefix for tables in NDO-db
dbprefix="icinga_"
; instance name for tables in NDO-db
dbinstancename="default"

4. service httpd restart

http://icinga-server/nagvis with admin:admin


5. Log in to the NagVis web interface, and click on Manage Maps under the Options menu:

wKiom1L9g9LwGjLCAAB4ke7tNok692.jpg


6. Under Create Map:
   1. For Map name, enter the value automap.
   2. For Map iconset, choose std_small.
   3. Leave Background blank.
   4. Click on Create.

wKioL1L9g97BlbQSAAB8vSIGsYE097.jpg


7. Click on Map Options under the Edit Map menu.

wKioL1L9g_GQBk6cAACAPeo3CLA338.jpg


8. In the resulting dialog:

   1. Check the sources checkbox, and change the value to automap.
   2. Check the backend_id checkbox, and choose the value ndomy_1.
   3. Scroll down to the bottom and click on Save.

wKiom1L9hCrSfE3zAACodoryD7M676.jpg


9. With this done, the page should refresh and show you a map of your network, automaticall generated from your configuration, in a similar style to the Icinga classic gui interface status map. You should also be able to hover over individual nodes to see their details.

wKiom1L9hIOSE0ArAAHUzeLtHtM969.jpg



Install check_mk with Icinga


1. yum -y install gcc-c++
tar zxf check_mk-1.2.4.tar.gz
cd check_mk-1.2.4
./setup.sh

please check below setting for it:

bindir='/usr/local/check_mk/bin'
confdir='/usr/local/check_mk/etc'
sharedir='/usr/local/check_mk/share'
docdir='/usr/local/check_mk/doc'
checkmandir='/usr/local/check_mk/doc/manuals'
vardir='/usr/local/check_mk/var'
agentslibdir='/usr/local/check_mk/extensions'
agentsconfdir='/usr/local/check_mk/etc'
nagiosuser='icinga'
wwwuser='apache'
wwwgroup='icinga'
nagios_binary='/usr/local/icinga/bin/icinga'
nagios_config_file='/usr/local/icinga/etc/icinga.cfg'
nagconfdir='/usr/local/icinga/etc/conf.d'
nagios_startscript='/etc/init.d/icinga'
nagpipe='/usr/local/icinga/var/rw/icinga.cmd'
check_result_path='/usr/local/icinga/var/spool/checkresults'
nagios_status_file='/usr/local/icinga/var/status.dat'
check_icmp_path='/usr/local/icinga/libexec/check_icmp'
url_prefix='/'
apache_config_dir='/etc/httpd/conf.d'
htpasswd_file='/usr/local/icinga/etc/htpasswd.users'
nagios_auth_name='Icinga Access'
pnptemplates='/usr/local/pnp4nagios/share/templates'
rrd_path='/usr/local/pnp4nagios/var/perfdata'
rrdcached_socket='/tmp/rrdcached.sock'
enable_livestatus='yes'
nagios_version='3.5.0'
libdir='/usr/local/check_mk/lib'
livesock='/usr/local/icinga/var/rw/live'
livebackendsdir='/usr/local/check_mk/livestatus'
enable_mkeventd='yes'
mkeventdstatedir='/usr/local/check_mk/mkeventd'


chkconfig --add mkeventd
vi /etc/init.d/mkeventd
MKEVENTD_SYSLOG=on


service mkeventd start


2. rpm -ivh http://mirrors.sohu.com/fedora-epel/6Server/x86_64/epel-release-6-8.noarch.rpm
yum -y install mod_python


3. vi /usr/local/check_mk/etc/multisite.mk
admin_users = [ "icingaadmin" ]

wKiom1MALlLjt-jCAASs56gaHlo445.jpg


service icinga restart
service httpd restart


4. http://icinga-server/check_mk/  using icingaadmin:icingaadmin


5. Install the agent on localhost
yum -y install xinetd
service xinetd start; chkconfig xinetd on


cd /usr/local/check_mk/share/agents

cp check_mk_agent.linux /usr/bin/check_mk_agent

cp waitmax /usr/bin
cp xinetd.conf /etc/xinetd.d/check_mk
service xinetd restart


vi /usr/local/check_mk/etc/main.mk
all_hosts = [ "localhost" ]


vi /usr/local/icinga/etc/icinga.cfg
comment cfg_file lines as below:

wKioL1MAUubzM14_AAPZAR2BY5A196.jpg

log_external_commands=0
log_passive_checks=0


/usr/local/check_mk/bin/cmk -I localhost

vi /usr/local/check_mk/var/autochecks/localhost.mk to remove unwanted item as you needed/usr/local/check_mk/bin/cmk -R


http://icinga-server/check_mk/  using icingaadmin:icingaadmin

wKioL1MALj_wIBXqAAitb3VhYgg981.jpg


Remove monitored client from check_mk

vi /usr/local/check_mk/etc/main.mk

remove item for it


/usr/local/check_mk/bin/cmk -R


Modify service for monitored client

vi /usr/local/check_mk/var/autochecks/*.mk to remove unneed item

/usr/local/check_mk/bin/cmk -R


renew service for host

/usr/local/check_mk/bin/cmk -II host-name

vi /usr/local/check_mk/var/autochecks/*.mk to remove unneed item

/usr/local/check_mk/bin/cmk -R


for linux and windows check_mk agent installation, please refer http://hj192837.blog.51cto.com/655995/1359213


Managing NagVis permissions in WATO


As this module only works in OMD environments at the moment now , we should remove it from check_mk available snapins

cd /usr/local/check_mk/share/web/plugins/sidebar/

mv nagvis_maps.py nagvis_maps.py.bak

service icinga restart

service httpd restart


Interface in PNP service graph has red error issue:


1. you will find below error

wKioL1MDU9Cju0SnAAkz-RbxsE0463.jpg


2. to resolve this issue, just upgrade to rrdtool 1.4

yum -y install ruby
rpm -Fvh rrdtool-perl-1.4.7-1.el6.wrl.x86_64.rpm rrdtool-1.4.7-1.el6.wrl.x86_64.rpm

wKiom1MDVAngIKCrAAP5AnATz60346.jpg


To get popup PNP graph in check_mk


1. vi /usr/local/nagios/etc/nagios.cfg

broker_module=/usr/local/check_mk/lib/livestatus.o pnp_path=/usr/local/pnp4nagios/var/perfdata /usr/local/nagios/var/rw/live

2. now it's done

wKiom1MMUUrwkZGtAARh2ikAH2w666.jpg

你可能感兴趣的:(icinga)