Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nagios installation configuration on Red Hat

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "Nagios installation and configuration on Red Hat". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Introduction to NDOUtils

NDOUTILS ADDON is mainly used to store the configuration information of Nagios and the data generated by event into the database (the current beta version supports mysql and pgsql, and the stable version only supports mysql) to facilitate rapid data retrieval and processing, and provides a guarantee for others to manage these data through web interface programs.

In a large application, there may be multiple independent or distributed Nagios servers, and each Nagios server in this environment is often referred to as a Nagios instance. In a multi-Nagios instance environment, the data of all instances can be stored in one database, or the data of each instance can be stored separately.

In an environment with only one Nagios instance, the instance name is usually "default"; in a multi-instance environment, these Nagios instances need to be named separately.

NDO Utils mainly consists of the following four parts:

1) NDOMOD Event Broker Module (NDOMOD.O): used to output data generated by the Nagios process (data and logic), provided that Nagios enables the Event broker function at compile time. At the same time, the NDOMOD module can also export information about Nagios configuration (including dynamic data generated by the Nagios monitoring process runtime environment) to files, Unix domain sockets, or TCP sockets. NDO2DB will obtain data about Nagios through the above three ways.

2) NDO2DB: used to receive the information output by NDOMOD and LOG2NDO components and store it in the database. When started, the NDO2DB process creates a TCP socket or Unix domain socket to listen for connection requests from the client (output). Currently, only MySQL databases are supported.

Multiple clients can output data to a NDO2DB daemon at the same time, and NDO2DB will establish a connection process for each connected client (Nagios instance) to store, retrieve and process each client data independently.

3) LOG2NDO: used to output the history log of Nagios to the database through the NDO2DB process. There are still three ways for LOG2NDO to communicate with NDO2DB processes: standard files, Unix domain sockets or TCP sockets.

4) FILE2SOCK: read data from a standard file or standard input and output it to a Unix domain socket or TCP socket. When NDOMOD or LOG2NDO exports data to standard files, this tool can be used to read data from those standard files and send them to TCP sockets or Unix domain sockets that the NDO2DB process is listening to.

2. Install NDOUtils

# tar zxf ndoutils-1.4b8.tar.gz # cd ndoutils-1.4b8 #. / configure-- enable-mysql-- with-mysql-lib=/usr/lib-- with-mysql-inc=/usr/include-- disable-pgsql # make # cp-v src/ {ndomod-3x.o,ndo2db-3x,file2sock,log2ndo} / usr/local/nagios/bin

The first two of the files copied above are version-related, that is, if your nagios major version number is 2 series, you need to copy two files named ndomod-2x.o and ndo2db-2x. The last two are general-purpose files that need to be copied no matter which version.

3. Create a database for NDOUtils

# mysql-uroot-p mysql > create database ndodb; mysql > GRANT SELECT,INSERT,UPDATE,DELETE ON ndodb.* TO ndouser@localhost IDENTIFIED BY '123456; mysql > flush privileges

The following two commands are used to generate database tables needed by ndoutils, and so on, which are prefixed with "nagios_" by default; install script commands must be executed in the DB subdirectory:

# cd db #. / installdb-u ndouser-p 123456-h localhost-d ndodb

The meaning of each of these options is as follows:

-u is used to specify the mysql user account used for import

-p indicates the password of the previous mysql user

-h indicates the mysql server address. If it is localhost, it can be omitted.

-d indicates the target database

Note: if integrated with cacti, the npc plug-in will automatically generate the tables needed by ndoutils in cacti's database, which are prefixed with "npc_". We will continue to explain these points in later articles on integration.

4. Copy and edit configuration files

# cd.. # cp-v config/ {ndo2db.cfg,ndomod.cfg} / usr/local/nagios/etc # vi / usr/local/nagios/etc/nagios.cfg

Add to the file:

Broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg

In addition, make sure that the following line appears in your / usr/local/nagios/etc/nagios.cfg, otherwise, add it yourself:

Event_broker_options=-1 / / enable event broker for Nagios

5. Edit the configuration files of the ndo2db daemon and ndomod

# vi / usr/local/nagios/etc/ndo2db.cfg socket_type=tcp db_servertype=mysql db_host=localhost db_port=3306 db_prefix=nagios_ db_user=ndouser db_pass=123456

Description:

I) the above options starting with "db_" are used to specify the properties of the connection to the database

Ii) the default way to receive data is Unix domain socket, which is modified to TCP socket; at the same time, the output mode specified in ndomod.cfg configuration file should be modified accordingly

Next, let's edit the configuration file of ndomod to specify the data output method and the output target host:

# vi / usr/local/nagios/etc/ndomod.cfg output_type=tcpsocket output=127.0.0.1

6. Start the ndo2db daemon

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

It is recommended that you check the system log (/ var/log/messages) for errors at this time.

If the Nagios process is started at this time, you need to stop and restart nagios:

# killall-SIGHUP nagios # rm-f / usr/local/nagios/var/nagios.lock # / usr/local/nagios/bin/nagios-d / usr/local/nagios/etc/nagios.cfg

Description:

I) stopping Nagios here must be done by sending a SIGHUP signal to Nagios

Ii) it is recommended to check whether the nagios log file indicates whether the module loading of ndomod is normal, and whether it can connect to data sink; to view the log. You can use the following command: # tail-30 / usr/local/nagios/var/nagios.log

Troubleshooting message:

I) if the ndomod module fails to load properly, it is recommended to re-check whether the required broker module entries have been added to the configuration file of nagios

Ii) at the same time, if ndomod is not properly connected to data sin, it is recommended to check whether the mysql connection project is specified correctly in the ndo2db.cfg file.

Iii) verify that the option for the location of the mysql library file is specified when compiling NDOUtils

This is the end of "Nagios installation configuration on Red Hat". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report