Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Install NDOUtils in Ubuntu – How we do it

by | Mar 31, 2021

Wondering how to Install NDOUtils in Ubuntu? We can help you.

Often our customers report that their Nagios core is not starting. This can be due to an outdated version of NDOUtils.

Here at Bobcares, we do NDOUtils installation on the servers of our customers as a part of our Server Management Services.

Today let’s see the steps that our Support Engineers follow to install NDOUtils

Steps to install NDOUtils in Ubuntu

Following are the steps that our Support Techs use to install NDOUtils in Ubuntu:

1. Installing MySQL

This can be done using the following commands:

$ sudo apt-get update
$ sudo apt-get install -y mysql-server libmysqlclient-dev libdbd-mysql-perl

Provide the root password if it prompts to while installing..

For checking, if MySQL is running we can use the following:

$ ps ax | grep mysql | grep -v grep

We will see an output similar to the one given below:

8142 ? Ssl 0:01 /usr/sbin/mysqld

2. Creating Database

NDOUtils requires creating a database known as Nagios.

Also, we will create a user account called ndoutils with the password ndoutils_password.

The storage location of the database will be the default location that MySQL uses.

The following command will connect to the local MySQL database engine interface.

$ mysql -u root -p'mypassword'

After that execute the following four commands one by one:

CREATE DATABASE nagios DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'ndoutils'@'localhost' IDENTIFIED BY 'ndoutils_password';
GRANT USAGE ON *.* TO 'ndoutils'@'localhost' IDENTIFIED BY 'ndoutils_password' 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 ;

Then exit the local MySQL database engine interface.

Run the following command to ensure that the database has been created:

$ echo 'show databases;' | mysql -u ndoutils -p'ndoutils_password' -h localhost

We can see the following output:

Database
information_schema
nagios
test

3. Modifying Linux Kernel Settings

NDOUtils uses the kernel message queue for transferring the data from Nagios to NDOUtils.

Here we will increase the default values the Kernel boots with to ensure it operates optimally.

Firstly, we will create a backup of  /etc/sysctl.conf file:

$ sudo cp /etc/sysctl.conf /etc/sysctl.conf_backup

After that we need to execute the following commands:

$ sudo sed -i '/msgmnb/d' /etc/sysctl.conf
$ sudo sed -i '/msgmax/d' /etc/sysctl.conf
$ sudo sed -i '/shmmax/d' /etc/sysctl.conf
$ sudo sed -i '/shmall/d' /etc/sysctl.conf
$ sudo sh -c 'printf "\n\nkernel.msgmnb = 131072000\n" >> /etc/sysctl.conf'
$ sudo sh -c 'printf "kernel.msgmax = 131072000\n" >> /etc/sysctl.conf'
$ sudo sh -c 'printf "kernel.shmmax = 4294967295\n" >> /etc/sysctl.conf'
$ sudo sh -c 'printf "kernel.shmall = 268435456\n" >> /etc/sysctl.conf'
$ sudo sysctl -e -p /etc/sysctl.conf

We do not have to reboot the system as the last command ensures that the new settings are active in the kernel.

4. Downloading NDOUtils Source

We can use the following commands for downloading NDOUtils:

$ cd /tmp
$ wget -O ndoutils.tar.gz https://github.com/NagiosEnterprises/ndoutils/archive/ndoutils-2.1.3.tar.gz
$ tar xzf ndoutils.tar.gz

5. Compiling NDOUtils

For compiling we can use the following commands:

$ cd /tmp/ndoutils-ndoutils-2.1.3/
$ sudo ./configure
$ sudo make all

6. Installing Binaries

To install the binary files, we can run the following command:

$ sudo make install

7. Initializing Database

This prepares the database for NDOUtils.

$ cd db/
$ sudo ./installdb -u 'ndoutils' -p 'ndoutils_password' -h 'localhost' -d nagios
$ cd ..

The command will produce output similar to the following:

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!

We can ignore the first line of output that says failed: Table ‘nagios.nagios_dbversion’ .

8. Installing Configuration Files

The two config files are:

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

The following lines are defined in this file:

db_user=ndoutils
db_pass=ndoutils_password

We should make sure the username and password are correct.

2.  /usr/local/nagios/etc/ndomod.cfg

No changes are required in this file.

Using the default username and password, the following commands will install the configuration files

$ sudo make install-config
$ sudo mv /usr/local/nagios/etc/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
$ sudo sh -c 'sed -i 's/^db_user=.*/db_user=ndoutils/g' /usr/local/nagios/etc/ndo2db.cfg'
$ sudo sh -c 'sed -i 's/^db_pass=.*/db_pass=ndoutils_password/g' /usr/local/nagios/etc/ndo2db.cfg'
$ sudo mv /usr/local/nagios/etc/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg

9. Install Service/Daemon

For Ubuntu 13.x/14.x

$ sudo make install-init

For Ubuntu 15.x/16.x/17.x

$ sudo make install-init
$ sudo systemctl enable ndo2db.service

10. Start Service/Daemon

Different Linux distributions have different methods of starting the ndo2db service.

For Ubuntu 13.x/14.x

$ sudo service ndo2db start

For Ubuntu 15.x/16.x/17.x

$ sudo systemctl start ndo2db.service

11. Updating Nagios To Use NDO Broker Module

Now we need to tell Nagios to use the NDO broker module.

We can add the following line to the nagios.cfg file:

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

The following commands will add that line as well as an extra line that explains what the module is for.

$ sudo sh -c 'printf "\n\n# NDOUtils Broker Module\n" >> /usr/local/nagios/etc/nagios.cfg'
$ sudo sh -c 'printf "broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg\n" >> /usr/local/nagios/etc/nagios.cfg'

12. Restarting Nagios

Now we need to restart Nagios to use the NDO broker module. Different Linux distributions have different methods of restarting Nagios Core. We will also check the status of the Nagios service to ensure it is running after these changes.

Ubuntu 13.x/14.x
$ sudo service nagios restart
$ sudo service nagios status

Ubuntu 15.x/16.x/17.x
$ sudo systemctl restart nagios.service
$ sudo systemctl status nagios.service

The last command should show Nagios running:

Ubuntu 13.x/14.x

nagios (pid 5345) is running…

Ubuntu 15.x/16.x/17.x

● nagios.service – LSB: Starts and stops the Nagios monitoring server
Loaded: loaded (/etc/rc.d/init.d/nagios)
Active: active (running) since Tue 2021-03-30 12:31:00 AEDT; 22s ago

13. Check NDOUtils Is Working

There are a couple of different ways to ensure NDO2DB is working.

This command will show Nagios successfully loaded the NDO module:

$ grep ndo /usr/local/nagios/var/nagios.log

The last command should output something like:

[1475544660] ndomod: NDOMOD 2.1.1 (09-06-2016) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1475544660] ndomod: Successfully connected to data sink. 0 queued items to flush.
[1475544660] ndomod registered for process data
[1475544660] ndomod registered for timed event data
[1475544660] ndomod registered for log data'
[1475544660] ndomod registered for system command data'
[1475544660] ndomod registered for event handler data'
[1475544660] ndomod registered for notification data'
[1475544660] ndomod registered for service check data'
[1475544660] ndomod registered for host check data'
[1475544660] ndomod registered for comment data'
[1475544660] ndomod registered for downtime data'
[1475544660] ndomod registered for flapping data'
[1475544660] ndomod registered for program status data'
[1475544660] ndomod registered for host status data'
[1475544660] ndomod registered for service status data'
[1475544660] ndomod registered for adaptive program data'
[1475544660] ndomod registered for adaptive host data'
[1475544660] ndomod registered for adaptive service data'
[1475544660] ndomod registered for external command data'
[1475544660] ndomod registered for aggregated status data'
[1475544660] ndomod registered for retention data'
[1475544660] ndomod registered for contact data'
[1475544660] ndomod registered for contact notification data'
[1475544660] ndomod registered for acknowledgement data'
[1475544660] ndomod registered for state change data'
[1475544660] ndomod registered for contact status data'
[1475544660] ndomod registered for adaptive contact data'
[1475544660] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.

Service Commands for NDOUtils in Ubuntu

Different Linux distributions have different methods of starting/stopping/restarting/status ndo2db following are some service commands:

Ubuntu 13.x/14.x

$ sudo start ndo2db
$ sudo stop ndo2db
$ sudo restart ndo2db
$ sudo status ndo2db

Ubuntu 15.x/16.x/17.x

$ sudo systemctl start ndo2db.service
$ sudo systemctl stop ndo2db.service
$ sudo systemctl restart ndo2db.service
$ sudo systemctl status ndo2db.service

How to fix ndo2db not running?

So far we saw how to install NDOUtils in Ubuntu now we will see how to fix one of the common error seen with NDOUtils.

Nagios server shuts off unexpectedly and we can see the “database backend” with a red exclamation in the web GUI.

And when we try to start the process, it comes back with ndo2db is not running.

Steps to fix this issue:

1. Firstly, we will verify whether ndo2db is not running using the following command:

# service ndo2db status
ndo2db is not running

2. After that, we will stop the Nagios service for not interrupting any processes.

# service nagios stop

3. Then we will run the ‘ls’ command to find the output similar to the one given below:

# ls -l /usr/local/nagios/var/ndo*
-rw-r--r-- 1 nagios nagios 0 Oct 18 09:02 /usr/local/nagios/var/ndo2db.debug
-rw-r--r-- 1 nagios nagios 6 Oct 23 10:13 /usr/local/nagios/var/ndo2db.lock
-rw-r--r-- 1 nagios nagios 0 Nov 12 12:43 /usr/local/nagios/var/ndomod.tmp
srwxr-xr-x 1 nagios nagios 0 Oct 23 10:13 /usr/local/nagios/var/ndo.sock

4. Now we will rename/move the two files using the following commands:

# mv /usr/local/nagios/var/ndo2db.lock /usr/local/nagios/var/ndo2db.lock.bak
# mv /usr/local/nagios/var/ndo.sock /usr/local/nagios/var/ndo.sock.bak

5. After that, we will restart the Nagios service and ndo2db service using the following commands:

# service nagios start
# service ndo2db start

Finally, we will run the service status command to verify it is now running.

# service ndo2db status
ndo2db (pid 3047) is running...

[Need assistance? We are available 24*7]

Conclusion

In short, we saw how our Support Engineers install NDOUtils in Ubuntu.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF