Tuesday 22 January 2013

How to Install Ndoutils on nagios 3.4.3

How to install ndoutils on centos
How to Install Ndoutils on nagios version 3 above
==================================================


Install Ndoutils pre-requists
-----------------------------

# yum -y install mysql mysql-server mysql-client gcc-c++ libdbi-dbd-mysql
# /etc/init.d/mysqld start
# /sbin/chkconfig mysqld on
# /usr/bin/mysqladmin -u root password your_password


Create database for nagios
---------------------------

# mysql -u root -pyourpassword
mysql> create database ndoutils;
mysql> grant all privileges on ndoutils.* to 'nagios'@'localhost' identified by “nagios” with grant option;
mysql> flush privileges;
mysql> quit

Download ndoutils
-----------------

# mkdir /opt/downloads
# cd /opt/downloads
# wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gz/download
# cd /opt/downloads/ndoutils-1.4b9

Installing ndoutils
--------------------

./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios -with-ndo2db-group=nagcmd

make

Manual install ( NO MAKE INSTALL )

-----------------------------------
# db/installdb -u nagios -p nagios -h localhost -d nagios

# cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
# cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
# cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
# cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
# chmod 774 /usr/local/nagios/bin/ndo*
# chown nagios:nagios /usr/local/nagios/bin/ndo*

Install the init script
------------------------

# cp ./daemon-init /etc/init.d/ndo2db
# chmod +x /etc/init.d/ndo2db
# chkconfig -add ndo2db


Edit nagios.cfg and verify or add the following lines
------------------------------------------------------
# vim /usr/local/nagios/etc/nagios.cfg

event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

Make necessary modifications in ndo2db.cfg file ( My Sample cfg file )
----------------------------------------------------------------------
# vim /usr/local/nagios/etc/ndo2db.cfg
db_user=nagios
db_pass=nagios

Start the ndo2db init script and restart the nagios
----------------------------------------------------

# /etc/init.d/ndo2db start
# /etc/init.d/nagios restart

You will get the log report like this

# tail -f /usr/local/nagios/var/nagios.log
[1296905045] LOG VERSION: 2.0
[1296905045] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1296905045] ndomod: Successfully connected to data sink. 0 queued items to flush.
[1296905045] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1296905045] Finished daemonizing... (New PID=7529)

Errors & Solutions:
*******************

if you get error: Could not open data sink
—————————
[1307690851] Nagios 3.2.3 starting… (PID=10660)
[1307690851] Local time is Fri Jun 10 00:27:31 PDT 2011
[1307690851] LOG VERSION: 2.0
[1307690851] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1307690851] ndomod: Could not open data sink! I’ll keep trying, but some output may get lost…
[1307690851] Event broker module ‘/usr/local/nagios/bin/ndomod.o’ initialized successfully.
[1307690851] Finished daemonizing… (New PID=10661)
—————————
Following these steps:
chmod 666 /usr/local/nagios/etc/ndomod.cfg
chmod 666 /usr/local/nagios/etc/ndo2db.cfg
/etc/init.d/ndo2db stop
/etc/init.d/nagios stop
/etc/init.d/ndo2db start
/etc/init.d/nagios start

#Again check

#tail -f /usr/local/nagios/var/nagios.log

10 comments:

  1. hi!
    I've no problem with data sink but mysql database is still empty.
    some ideas?

    ReplyDelete
  2. Hi have you run the below command, which only creates the tables in database.

    # db/installdb -u nagios -p nagios -h localhost -d nagios

    ReplyDelete
  3. hi, I just did it

    I've the database in mysql with all tables, but informations from nagios don't populate it

    ReplyDelete
  4. Hi Alessandro Caroppo

    I have tested it's working fine without any issue. Please provide your execution steps..so that i can verify..

    ReplyDelete
  5. Hi, thanks for the answer.

    First I start ndo2db by init.d script, than I run nagios

    for ndo2db installation I followed the ndoutils official guide...

    ReplyDelete
  6. chmod 666 of the cfg files is not neccessary, they just need to be owned by the nagios user.

    ReplyDelete
  7. [root@localhost ~]# /etc/init.d/ndo2db start
    Starting ndo2db:Support for the specified database server is either not yet supported, or was not found on your system.
    done.

    ReplyDelete
  8. i fallowed above steps but iam facing this error:could not load module /usr/local/nagios/bin/ndomod.o , aborting . can any one help me to resolve.

    ReplyDelete
  9. Please let me know the version for Ndoutils and OS.

    ReplyDelete
  10. Is there a ready ndoutils for mongodb as database. I am new to this.

    ReplyDelete