Learn how to install Nagios NDOUtils on CentOS 7 with our comprehensive guide. Follow detailed steps to set up and configure NDOUtils, ensuring efficient monitoring and database integration on your CentOS 7 system. #centlinux #linux #nagios
Table of Contents
What is NDOUtils?
NDOUtils is a plugin for Nagios Core. By default, Nagios Core stores its data in flat files. Nagios NDOUtils allow us to export current and historical data from Nagios Core instance/s to a MySQL database. NDOUtils is included with Nagios XI (the commercial version of Nagios). Also many community addons uses NDOUtils as a data source. NDOUtils consist of a standalone daemon, a Nagios event broker and several helper utilities.

Nagios Server Specification
We have a CentOS 7 virtual machine with following specification.
- Hostname – nagios-01.example.com
- IP Address – 192.168.116.143/24
- Operating System – CentOS 7.6
- Nagios Version – Nagios Core 4.4
Before moving forward, make sure that you have configured a Nagios Core server. For installation steps, you can refer to our previous article Install Nagios Core on CentOS 7.
Recommended Training: Nagios | Ultimate IT monitoring guide with EyesOfNetwork from Tech Academy

Install MariaDB on CentOS 7
NDOUtils requires a MariaDB or MySQL database for storing Nagios Core data. Therefore, we are installing the available MariaDB server from CentOS 7 yum repository.
yum install -y mariadb-server mariadb-devel mariadb
Start and enable MariaDB service.
systemctl start mariadb.service
systemctl enable mariadb.service
Configure MariaDB database instance.
mysql_secure_installation
Output:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Read Also: How to install Nagios Core on Ubuntu 20.04
Create a MariaDB database for NDOUtils
Connect to nagios-01.example.com using ssh as root user.
Use mysql command to connect with MariaDB instance as root user.
mysql -u root -p'123'
Use the following commands to create a database and user for NDOUtils.
CREATE DATABASE nagios DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'ndoutils'@'localhost' IDENTIFIED BY 'ahmer123';
GRANT USAGE ON *.* TO 'ndoutils'@'localhost' IDENTIFIED BY 'ahmer123' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON nagios.* TO 'ndoutils'@'localhost' WITH GRANT OPTION ;
FLUSH PRIVILEGES;
Exit from mysql prompt.
QUIT
Adjust Kernel Parameters
Some Kernel Parameters are required to be set for NDOUtils.
Remove any previous setting of following Kernel parameters from /etc/sysctl.conf.
sed -i '/msgmnb/d' /etc/sysctl.conf
sed -i '/msgmax/d' /etc/sysctl.conf
sed -i '/shmmax/d' /etc/sysctl.conf
sed -i '/shmall/d' /etc/sysctl.conf
Now, add required values for these parameters as follows.
cat >> /etc/sysctl.conf << EOF
kernel.msgmnb = 131072000
kernel.msgmax = 131072000
kernel.shmmax = 4294967295
kernel.shmall = 268435456
EOF
Reload Kernel parameters from configuration files.
sysctl -p
Output:
kernel.msgmnb = 131072000
kernel.msgmax = 131072000
kernel.shmmax = 4294967295
kernel.shmall = 268435456
LFM 2nd Edition: Linux Field Manual
$19.88 (as of June 22, 2025 20:15 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Install Nagios NDOUtils on CentOS 7
Download Nagios NDOUtils source from SourceForge website.
wget -O ndoutils.tar.gz https://sourceforge.net/projects/nagios/files/ndoutils-2.x/ndoutils-2.1.3/ndoutils-2.1.3.tar.gz/download
Extract downloaded file.
tar xf ndoutils.tar.gz
Compile NDOUtils binaries from source.
cd ndoutils-2.1.3
./configure
Output:
...
config.status: creating startup/rh-upstart-init
config.status: creating include/config.h
*** Configuration summary for ndoutils 2.1.3 2017-04-13 ***:
General Options:
-------------------------
NDO2DB user: nagios
NDO2DB group: nagios
NDO2DB tcp port: 5668
Review the options above for accuracy. If they look
okay, type 'make all' to compile the NDO utilities,
or type 'make' to get a list of make options.
# make all
...
make[2]: Leaving directory `/tmp/ndoutils-2.1.3/src'
make ndomod-4x.o
make[2]: Entering directory `/tmp/ndoutils-2.1.3/src'
gcc -fPIC -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H -I ../include/nagios-4x -D BUILD_NAGIOS_4X -o ndomod-4x.o ndomod.c io.o utils.o -shared -lnsl
make[2]: Leaving directory `/tmp/ndoutils-2.1.3/src'
gcc -fPIC -g -O2 -I/usr/include/mysql -DHAVE_CONFIG_H -o sockdebug sockdebug.c io.o utils.o -lm -lnsl
make[1]: Leaving directory `/tmp/ndoutils-2.1.3/src'
Install Nagios NDOUtils binaries.
make install
Output:
cd ./src && make install
make[1]: Entering directory `/tmp/ndoutils-2.1.3/src'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin
/usr/bin/install -c -m 755 -o nagios -g nagios ndo2db-4x /usr/local/nagios/bin/ndo2db
/usr/bin/install -c -m 755 -o nagios -g nagios ndomod-4x.o /usr/local/nagios/bin/ndomod.o
/usr/bin/install -c -m 774 -o nagios -g nagios file2sock /usr/local/nagios/bin
/usr/bin/install -c -m 774 -o nagios -g nagios log2ndo /usr/local/nagios/bin
/usr/bin/install -c -m 774 -o nagios -g nagios sockdebug /usr/local/nagios/bin
Hint: NDOUtils Installation against Nagios v4.x
completed.
If you want to install NDOUtils for Nagios v3.x
please type 'make install-3x
If you want to install NDOUtils for Nagios v2.x
please type 'make install-2x
Next step should be the database initialization/upgrade
cd into the db/ directory and either:
./installdb (for a new installation) or:
./upgradedb (for an existing one)
make[1]: Leaving directory `/tmp/ndoutils-2.1.3/src'
Main NDOUtils components installed
Create database tables to store Nagios data.
cd db
./installdb -u 'ndoutils' -p 'ahmer123' -h 'localhost' -d nagios
Output:
DBD::mysql::db do failed: Table 'nagios.nagios_dbversion' doesn't exist at ./installdb line 52.
** Creating tables for version 2.0.1
Using mysql.sql for installation...
** Updating table nagios_dbversion
Done!
Ignore the failed warning, it is here to check if database is already initialized.
Install Nagios NDOUtils configuration files.
make install-config
Output:
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var
/usr/bin/install -c -m 644 -o nagios -g nagios config/ndo2db.cfg-sample /usr/local/nagios/etc
/usr/bin/install -c -m 644 -o nagios -g nagios config/ndomod.cfg-sample /usr/local/nagios/etc
*** Config files installed ***
Remember, these are *SAMPLE* config files. You'll need to rename
the files in order to use them.
Please read the documentation to know what they are doing.
Edit these configuration files according to your environment.
We are only defining MariaDB user credentials here leaving all the other settings as defaults.
cd /usr/local/nagios/etc/
mv ndo2db.cfg-sample ndo2db.cfg
mv ndomod.cfg-sample ndomod.cfg
sed -i 's/^db_user=.*/db_user=ndoutils/g' ndo2db.cfg
sed -i 's/^db_pass=.*/db_pass=ahmer123/g' ndo2db.cfg
Install Nagios NDOUtils service.
cd /tmp/ndoutils-2.1.3/
make install-init
Output:
/usr/bin/install -c -m 644 startup/default-service /usr/lib/systemd/system/ndo2db.service
Start and enable ndo2db.service.
systemctl start ndo2db.service
systemctl enable ndo2db.service
Configure Nagios NDOUtils Broker Module
Edit nagios.cfg file, so Nagios Core can use NDOUtils broker module.
cat >> /usr/local/nagios/etc/nagios.cfg << EOF
#NDOUtils Broker Module
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
EOF
Restart nagios.service to reload changes.
systemctl restart nagios.service
USB C Laptop Charger 45W for hp chromebook/Spectre X360, Lenovo ThinkPad/Yoga, Dell Chromebook/Latitude, Acer, Asus, Samsung, Google Series Universal Chromebook USB C Type C Power Cord
$6.29 (as of June 22, 2025 19:46 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Test NDOUtils Integration with Nagios Core
Check NDOUtils broker module is used by Nagios Core by quering Nagios logs.
grep ndo /usr/local/nagios/var/nagios.log
Output:
...
[1557602671] ndomod registered for adaptive contact data'
[1557602671] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
Check whether Nagios NDOUtils is forwarding entries to our MariaDB database.
echo 'select * from nagios.nagios_logentries;' | mysql -u ndoutils -p'ahmer123'
Output:
logentry_id instance_id logentry_time entry_time entry_time_useclogentry_type logentry_data realtime_data inferred_data_extracted
1 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767227 262144 ndomod registered for log data' 1 1
2 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767255 262144 ndomod registered for system command data' 1 1
3 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767270 262144 ndomod registered for event handler data' 1 1
4 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767284 262144 ndomod registered for notification data' 1 1
5 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767298 262144 ndomod registered for service check data' 1 1
6 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767312 262144 ndomod registered for host check data' 1 1
7 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767326 262144 ndomod registered for comment data' 1 1
8 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767340 262144 ndomod registered for downtime data' 1 1
9 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767354 262144 ndomod registered for flapping data' 1 1
10 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767367 262144 ndomod registered for program status data' 1 1
11 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767381 262144 ndomod registered for host status data' 1 1
12 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767395 262144 ndomod registered for service status data' 1 1
13 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767408 262144 ndomod registered for adaptive program data' 1 1
14 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767422 262144 ndomod registered for adaptive host data' 1 1
15 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767436 262144 ndomod registered for adaptive service data' 1 1
16 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767449 262144 ndomod registered for external command data' 1 1
17 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767463 262144 ndomod registered for aggregated status data' 1 1
18 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767476 262144 ndomod registered for retention data' 1 1
19 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767490 262144 ndomod registered for contact data' 1 1
20 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767504 262144 ndomod registered for contact notification data' 1 1
21 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767518 262144 ndomod registered for acknowledgement data' 1 1
22 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767532 262144 ndomod registered for state change data' 1 1
23 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767546 262144 ndomod registered for contact status data' 1 1
24 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767560 262144 ndomod registered for adaptive contact data' 1 1
25 1 2019-05-12 00:24:31 2019-05-12 00:24:31 767574 262144 Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully. 11
26 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768861 8 Warning: Service 'Current Load' on host 'localhost' has no check time period defined! 1 1
27 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768884 8 Warning: Service 'Current Users' on host 'localhost' has no check time period defined! 1 1
28 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768900 8 Warning: Service 'HTTP' on host 'localhost' has no check time period defined! 11
29 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768914 8 Warning: Service 'PING' on host 'localhost' has no check time period defined! 11
30 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768929 8 Warning: Service 'Root Partition' on host 'localhost' has no check time period defined! 1 1
31 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768944 8 Warning: Service 'SSH' on host 'localhost' has no check time period defined! 11
32 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768958 8 Warning: Service 'Swap Usage' on host 'localhost' has no check time period defined! 1 1
33 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768973 8 Warning: Service 'Total Processes' on host 'localhost' has no check time period defined! 1 1
34 1 2019-05-12 00:24:31 2019-05-12 00:24:31 768996 8 Warning: Service 'C: Drive Space' on host 'winserver' has no check time period defined! 1 1
35 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769012 8 Warning: Service 'CPU Load' on host 'winserver' has no check time period defined!1 1
36 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769026 8 Warning: Service 'Explorer' on host 'winserver' has no check time period defined!1 1
37 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769040 8 Warning: Service 'Memory Usage' on host 'winserver' has no check time period defined! 1 1
38 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769054 8 Warning: Service 'NSClient++ Version' on host 'winserver' has no check time period defined! 1 1
39 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769068 8 Warning: Service 'Uptime' on host 'winserver' has no check time period defined! 11
40 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769082 8 Warning: Service 'W3SVC' on host 'winserver' has no check time period defined! 11
41 1 2019-05-12 00:24:31 2019-05-12 00:24:31 769103 8 Warning: Contact 'nagiosadmin' has no host notification time period defined! 11
42 1 2019-05-12 00:24:31 2019-05-12 00:24:31 821974 262144 Successfully launched command file worker with pid 14112 1 1
Redragon M612 Predator RGB Gaming Mouse, 8000 DPI Wired Optical Mouse with 11 Programmable Buttons & 5 Backlit Modes, Software Supports DIY Keybinds Rapid Fire Button
$13.79 (as of June 22, 2025 22:40 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Final Thoughts
Installing Nagios NDOUtils on CentOS 7 extends the capabilities of your Nagios Core monitoring system by allowing you to store status and event data in a MySQL database.
In this guide, we walked through setting up the necessary dependencies, compiling and installing NDOUtils, and configuring it to integrate with Nagios. With NDOUtils successfully installed, you now have a centralized and scalable way to store, query, and analyze monitoring data.
To ensure reliable operation, keep your database optimized, monitor performance, and regularly back up your Nagios and database configurations.
Whether you need cloud optimization, server management, or automation, I provide comprehensive AWS and Linux services. Hire me on Fiverr to elevate your systems.
Leave a Reply
You must be logged in to post a comment.