Synchronize configuration Nagios Monitoring with MySQL Database used NDOUtils

Nagios is an open source computer system monitoring, network monitoring and infrastructure monitoring software application. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts the users when things go wrong and alerts them a second time when the problem has been resolved.
If you have many hosts in Nagios, you may want to manipulate the generated data in other applications. The best way to do this is to store the Nagios data into a database.
NDOUtils allow you to export current and historical data from one or more Nagios instance to a MySQL or PostgreeSQL database.

Figure Schema Daemon NDOUtils

Figure 1. NDOUtils Schema Process
Figure 1. NDOUtils Schema Process

In this tutorial define how step to install and configure NDOUtils used to sync data configuration from Nagios Monitoring

Step 1. Install Nagios Core

Install Nagios Monitoring from ports

$ cd /usr/ports/net-mgmt/nagios
$ make install clean

Step 2. Install Nagios Plugins

Nagios plugins used to connecting service applications to daemon nagios

$ cd /usr/ports/net-mgmt/nagios-plugins/
$ make install clean

Step 3. Install MySQL Databases

After installing Nagios we must make sure have MySQL databases. If you have not install yet, type :

$ cd /usr/ports/databases/mysql55-server/
$ make install clean

Define your MySQL root password

$ mysqladmin -u root password 'new-password'

Next, we must create databases and initialize

$ mysql -u root -p
mysql>create user 'nagios'@'localhost' identified by 'password';
mysql>create database nagios;
mysql>grant all on nagios.* to 'nagios'@'localhost' identified by 'password';
mysql>exit;

Step 4. Install and Configure NDOUtils

Install NDOUtils from ports, and check MySQL Database or PostgreeSQL support

$ cd /usr/ports/net-mgmt/ndoutils/
$ make config
$ make install clean

If installation finish, please add script ndoutils start when boot

$ echo 'ndo2db_enable="YES"' >> /etc/rc.conf

Next, import sample database ndoutils to nagios database which we make before. Locate sample database in /usr/local/share/ndoutils/

$ mysql -u nagios -p nagios < /usr/local/share/mysql.sql

After that, move sample configurations .cfg-sample to .cfg in directory /usr/local/etc/nagios/

$ ls /usr/local/etc/nagios
cgi.cfg nagiosgraph ndoutils.cfg
htpasswd.users ndo2db.cfg objects
misccommands.cfg ndomod-3x.o.core resource.cfg
nagios.cfg ndomod.cfg

Next, open file ndoutils.cfg and add this line

broker_module=/usr/local/bin/ndomod-3x.o config_file=/usr/local/etc/nagios/ndomo
d.cfg

Next, open file ndomod.cfg and change this

instance_name=default
output_type=tcpsocket
output=127.0.0.1
buffer_file=/var/spool/nagios/ndomod.tmp  --> "ndomod.tmp must be create before"
file_rotation_timeout=60

Open file ndo2mod.cfg and change like this

lock_file=/var/spool/nagios/ndo2db.lock
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=tcp
socket_name=/var/spool/nagios/ndo.sock
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=nagios
db_prefix=nagios_
db_user=nagios
db_pass=nagios
debug_file=/var/spool/nagios/ndo2db.debug

Attention, file ndo2db.lock, ndo.sock, and ndo2db.debug must be create in directory /var/spool/nagios/ and user group must be nagios

Step 5. Configuration Nagios Monitoring

Open file nagios.cfg in directory /usr/local/etc/nagios/ and edit file

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

After all finish, lets try to start service ndoutils

$ /usr/local/bin/ndo2db-3x -c /usr/local/etc/nagios/ndo2db.cfg

And see databases nagios are inserted data on the table

Database
Figure 2. Database

Source : www.slideshare.netnagios.sourceforge.net

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s