Setup NDOutils for Nagios on CentOS

In this post I provide instructions on setting up the database plugin, NDOutils, for Nagios. The instructions were written for CentOS but most of it should easily carry over to another distro.

First things, elevate yourself to root.

su root

  1. Install GCC and update MySQL

yum install gcc
yum update mysql
yum install mysql-server
yum install mysql-devel

  1. Start mysql & Add mysql as Startup service

/etc/init.d/mysqld start
chkconfig --add mysqld

  1. Create MySQL Database

mysql
create database nagios;
GRANT ALL ON nagios.* TO nagios@localhost IDENTIFIED BY "nagios";
FLUSH PRIVILEGES;
quit

  1. Download and untar the latest release of NDOutils - http://sourceforge.net/projects/nagios/files/ndoutils-1.x/
  2. Copy to /tmp/
  3. Change directory to /tmp/

cd /tmp/
tar zxfv ndoutils-1.4b9.tar.gz

  1. Compile NDOutils

cd /ndoutils-1.4b9/
./configure
make

  1. Make /var/run/nagios folder & Change the ownership to nagios user

mkdir /var/run/nagios
chown nagios:nagios /var/run/nagios
chmod 755 /var/run/nagios

  1. Copy appropriate ndo2db.o & ndomod.o /usr/bin and set permissions
    "ndo2db-2x.o" & "ndomod-2x.o" for Nagios 2.x
    "ndo2db-3x.o" & "ndomod-3x.o" for Nagios 3.x

cp /tmp/ndoutils-1.4b9/src/ndo2db-3x.o /usr/bin/ndo2db
cp /tmp/ndoutils-1.4b9/src/ndomod-3x.o /usr/bin/ndomod
chmod 755 /usr/bin/ndo2db
chmod 755 /usr/bin/ndomod

  1. Create NDO database

cd /tmp/ndoutils-1.4b9/src/db
./installdb -u nagios -p nagios -h localhost -d nagios

  1. Copy configuration files

cp /tmp/ndoutils-1.4b9/config/ndo2db.cfg /etc/nagios
cp /tmp/ndoutils-1.4b9/config/ndomod.cfg /etc/nagios

  1. Modify /etc/nagios/ndo2b.cfg

nano /etc/nagios/ndo2db.cfg

  • Set lock_file=/var/run/nagios/ndo2db.lock
  • Set ndo2dbuser=nagio and ndo2dbgroup=nagios
  • Set socket_name=/var/run/nagios/ndo.sock
  • Set db_host=localhost , db_name=nagios , db_prefix=nagios_ , dp_user=nagios , dp_pass=nagios
  • Set debug_file=/var/run/nagios/ndo2db.debug
  • Set time intervals to store data
  1. Modify /etc/nagios/ndomod.cfg

nano /etc/nagios/ndomod.cfg

  • Set output=/var/run/nagios/ndo.sock
  • Set buffer_file=/var/run/nagios/ndomod.tmp
  1. Modify /etc/nagios/nagios.cfg
  • Add the follow line: broker_module=/usr/bin/ndomod config_file=/etc/nagios/ndomod.cfg
  1. Change ownership and permissions on config files

chown nagios:nagios /etc/nagios/ndo2db.cfg
chown nagios:nagios /etc/nagios/ndomod.cfg
chmod 664 /etc/nagios/ndo2db.cfg
chmod 664 /etc/nagios/ndomod.cfg

  1. Start NDO2DB

/usr/bin/ndo2db -c /etc/nagios/ndo2db.cfg

  1. Restart Nagios

/etc/init.d/nagios restart

4 thoughts on “Setup NDOutils for Nagios on CentOS”

  1. Hi Joe,
    Brilliant tutorial. Thanks mate. I run omdistro with check_mk. So when i connect to the nagiosdb and run a query i get a empty result. Which file directory should i be looking for in my setup?

Leave a Reply to Joe Steinkamp Cancel reply