Deployment and testing of Nagios data storage plug-in ndoutils

Source: Internet
Author: User
Tags unix domain socket

1. Overview

Ndoutils,nagios data Output Utils,nagios, which allows users to export status and event information from Nagios to the database for later retrieval and processing
It consists of several parts:

    • Ndomod
    • Ndo2db
    • File2sock
    • Log2ndo
2. Components Introduction 2.1 Ndomod

The Ndomod is an event interrupt module. This module is loaded when the Nagios process is running.
Its only role is to dump all of Nagios's events and data into TCP sockets, or plain files, or UNIX domain sockets.
If users want to forward data to MySQL in real time, they can transfer data to a TCP socket or a UNIX domain socket. If you want to delay the forwarding of data to the MySQL database, you can dump the data to a normal file.

2.2 Ndo2db

NDO2DB daemon process. This is a standard daemon that reads input data from a TCP socket or a UNIX socket (via the Ndomod event Interrupt module output).
NDO2DB analyzes the data and deposits them into one or more MySQL data. The ndo2db has the ability to simultaneously handle connections from multiple clients, so users can also configure multiple instances of NDOMOD modules that output data via TCP or UNIX sockets.

2.3 File2sock

The File2sock feature reads data from a common file and dumps it via TCP or UNIX sockets.
This is useful when the Ndomod module writes data to a normal file, but wants to dump it into a database usage scenario.
If the Ndomod module outputs data and the ndo2db running process is not on the same host, the user can forward the normal file holding the data through the SSH protocol to the host running the ndo2db process. The contents of the normal file are then forwarded to the TCP or UNIX port via the File2sock feature (ndo2db obtains data from these ports)

2.4 Log2ndo

The Log2ndo feature is used to archive and forward the history logs of Nagios and Netsaint to the ndo2db process. It also sends a log file to a TCP or UNIX socket to complete the data dump.

3. Compiling the installation

Configure

./configure --prefix=/usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3 --enable-mysql --with-opsys=linux --with-dist-type=rh --with-init-type=sysv --with-inetd-type=xinetd --with-mysql-lib=/usr/lib64/mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios

Note: The--with-mysql-lib option prompt is not recognized, but the MySQL library can be configured correctly, but when configured with the--WITH-MYSQL option, it does not actually take effect

Make
Directly execute make, prompt to choose the Make option, here Select Make all

  [[email protected] ndoutils-2.1.3]# makeplease enter make [option] where [option] is one of:all build s the NDO Utilities ndo2db builds the ndo2db daemon Ndomod builds the Ndomod nagios module File2sock builds th E file2sock utility Log2ndo builds the Log2ndo utility Sockdebug builds the Sockdebug utility Install-groups-u Sers Add the user and group if they do not exist install installs the module and programs Install-config installs     The sample configuration files install-inetd Install the startup files for inetd, launchd, etc.     Install-init Install the startup files for Init, systemd, etc. Fullinstall runs Install-groups-users, Install,install-config and Install-init  

Make Install
After execution, you are make install prompted to install a module that is suitable for Nagios v4.x. According to the documentation, if you need to install the modules for Nagios v3.x and v2.x, you will need to perform make install-3x and make install-2x , however, replace them.
This blog compiles all the modules and then copies them to the corresponding directory, specifying the absolute path of the module to be used in the configuration file.

Note: The make install-3x cannot be executed under the current unpacked directory, no makefile

As of here, Ndoutils has been compiled and installed.
Install database
This step requires the first creation of a database and authorization.

For this procedure, refer to the blog "MySQL database server (YUM) installation. MD", Blog Park address: https://www.cnblogs.com/liwanliangblog/p/9194704.html

Then go into the DB directory, execute the ./installdb script, and the result

Execute make install-init, install the startup script
Execute make install-inetd, install the hyper-process configuration file
This step requires adding port 5668 to/etc/services, which is added on the last line of/etc/services:

ndo2db          5668/tcp          # ndo2db

Execute make install-config, install the ndo2db.cfg configuration file

At this point, under the installation path /usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3/ , you can see three directories, namely:

    • Bin directory, storing ndomod.o,ndo2db,log2ndo,file2sock,sockdebug programs or libraries
    • Etc directory, storing ndo2db.cfg-sample configuration templates and Ndomod.cfg-sample configuration templates
    • var directory, variable data storage directory
4. Nagios configuration NDOUtils4.1 Copy configuration file

/usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3/etc/under, execute cp ndo2db.cfg-sample ndo2db.cfg andcp ndomod.cfg-sample ndomod.cfg

4.2 Nagios master configuration file modification

Modify the Nagios master configuration file as follows:

event_broker_options=1broker_module=/usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3/bin/ndomod-4x.o     config_file=/usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3/etc/ ndomod.cfg
4.3 ndo2db configuration file modification

/usr/local/globle/softs/monitor/nagios/ndoutils/2.1.3/etc/under, Ndomod.cfg is the Ndomod module configuration file, which can be used without modification. To modify the contents of the Ndo2db.cfg configuration file:

db_user=nagiosdb_pass=liwanliang

Note: The Db_user and Db_pass here are the database users and passwords when you create the Nagios database

4.4 Start

Because in the Configure process, NDO2DB has been specified to start the process in SysV mode, so you can service ndo2db start start the service
By ps -ef | grep ndo , you can see that the process has run started, through the lsof -p pid command, to view the process that opened the sock file.
Note: If you do not restart or reload the Nagios configuration at this time, the database will not have data
If you have restarted Nagios, but you do not see data updates through the database visualizer, you can disconnect and then log back in to the database to view

4.5 View 4.5.1 Database view

Connect to MySQL to see if the Nagios database has data through the database visualizer
Confirm configuration information, object configuration, alarm information and so on can be stored normally

Deployment and testing of Nagios data storage plug-in ndoutils

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.