Posted by: kezhong | May 29, 2011

Store data from Nagios into MySQL using NDOutils on Fedora 14

I’ve installed Nagios as my past post “Install and configure Nagios on Fedora 14 using YUM“. Now I want to store all configuration and event data into MySQL, because the development team wanted to design application to use all these information. 

Install MySQL and NDOutils
# yum -y install mysql mysql-devel mysql-server gcc-c++
# yum -y install ndoutils*
# chkconfig mysqld on
# service mysqld start
# chkconfig ndo2db on

Start a shell to MySQL and create and grant access to a database
# mysql -uroot -p
mysql> create database nagios
mysql> GRANT ALL ON nagios.* TO root@localhost IDENTIFIED BY “password”;
mysql> quit

Load the schema
# cd /usr/share/doc/ndoutils-mysql-*/db
# perl ./installdb -u root-p password -h localhost -d nagios
DBD::mysql::db do failed: Table ‘nagios.nagios_dbversion’ doesn’t exist at ./installdb line 51.
** Creating tables for version 1.4b9
     Using mysql.sql for installation…
** Updating table nagios_dbversion

Configure the /etc/nagios/nagios.cfg file
Open the /etc/nagios/nagios.cfg file, search “EVENT BROKER OPTIONS” section and make sure

Add the following one line in “EVENT BROKER MODULE(S)” section
broker_module=/usr/lib64/nagios/brokers/ config_file=/etc/nagios/ndomod.cfg

Configure the /etc/nagios/ndo2db.cfg file, and change the below three lines

Start ndo2db
# service ndo2db start

Restart Nagios
# service nagios restart

Check the log file if it works
# tail -f /var/log/messages
May 29 19:26:30 nagios nagios: Error: Could not load module ‘/usr/lib64/nagios/brokers/’ -> /var/log/nagios/spool/checkresults/nebmodi6yVIr: failed to map segment from shared object: Permission denied

From the above, it did not work

Disable SElinux, restart ndo2db and nagios, check the log file again. It works.
# setenforce 0
# service ndo2db restart
# service nagios restart
# tail -f /var/log/messages
# tail -f /var/log/ndoutils/ndo2db.debug

After it worked, configured the /etc/nagios/ndo2db.cfg file, set “debug_level=1”, restart ndu2db and nagios.



NDOutils on CentOS



  1. This blog is the best I’ve seen since very long time.
    Thank you for these valuable posts

  2. Which version of Nagios do you have?

  3. hello, i have a issue happens that every things into the log files looks fine… but..
    the data is not being writen in my MySQL Database. please help me thanks in advance..

  4. Thank you for your useful guide; I’ve some suggestion.
    1) don’t use the root user for mysql, better is to create a “nagios” user: GRANT ALL ON nagios.* TO nagios@localhost IDENTIFIED BY “password”;
    2) if someone has these errors in /var/log/messages:
    Jun 12 15:45:13 dashboard ndo2db: Message sent to queue.
    Jun 12 15:45:13 dashboard ndo2db: Warning: queue send error, retrying…
    Jun 12 15:45:14 dashboard ndo2db: Message sent to queue.
    Jun 12 15:45:14 dashboard ndo2db: Warning: queue send error, retrying…
    insert this configuration in /etc/sysctl.conf
    # Nagios
    kernel.msgmax = 131072000
    kernel.msgmnb = 131072000
    kernel.msgmni = 65536000
    and after the configuration restart the machine or enable runtime executing as root:
    sysctl kernel.msgmax=131072000
    sysctl kernel.msgmnb=131072000
    sysctl kernel.msgmni=65536000
    After that restart ndo2db and nagios

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s


%d bloggers like this: