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

How to install Nagios on Red Hat

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the knowledge of "how to install Nagios on Red Hat". In the operation of actual cases, many people will encounter such a dilemma, 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. Install and configure Nagios

1. Introduction to Nagios

Nagios is an open source network monitoring software that follows GPLv2, which can be used to monitor hosts and services of a variety of designated systems, and to notify administrators when their working status changes. Its features include:

1) Monitoring network services (HTTP, POP3, SMTP, PING, MySQL, etc.)

2) Monitor host resources (disk space utilization, memory utilization, CPU load, etc.)

3) simple plug-in design interface, which makes it easy for users to develop required detection scripts.

4) parallel service model

5) easily describe the network structure and be able to distinguish between "downtime" and "host unreachability"

6) notify the administrator of the change in the working status of the host or service by mail or user-defined method

7) automatic log scrolling

8) support redundant host monitoring

9) you can visually view the current network status, notification and problem history, log files, etc., through web. This component is optional.

Nagios usually consists of a main program (Nagios), a plug-in (Nagios-plugins), and four optional ADDON (NRPE, NSCA, NSClient++, and NDOUtils). The monitoring of Nagios is implemented through plug-ins, so Nagios and Nagios-plugins are necessary components for server-side work. Of the four ADDON, NRPE is used to execute script plug-ins on the monitored remote Linux/Unix host to monitor the resources of these hosts; NSCA is used to enable the monitored remote Linux/Unix host to actively send monitoring information to the Nagios server (this is especially used in redundant monitoring mode); NSClient++ is a component installed on the Windows host when monitoring the Windows host On the other hand, NDOUtils is used to store the configuration information of Nagios and the data generated by each event into the database to realize the rapid retrieval and processing of these data. Of the four ADDON (attachments), NRPE and NSClient++ work on the client side, NDOUtils on the server side, and NSCA needs to be installed on both the server side and the client side.

The following figure is the relationship diagram of the components of Nagios given by the author according to his own understanding, hoping to help readers understand. If you have any objection to the relationship in this composition, you are welcome to communicate with me in various ways.

Currently, Nagios can only be installed on the host of the Linux system, and its compilation requires gcc. At the same time, if you plan to use the management tools of the web interface, you also need to have the support of apache server and GD graphics library.

2. Preparation before installation

(1) solve the dependency of installing Nagios:

The operation of Nagios basic components depends on httpd, gcc, and gd. You can check whether the rpm package that nagios depends on is fully installed with the following command:

# rpm-q httpd gcc glibc glibc-common gd gd-devel

For missing rpm packages, you can mount the CD and install it directly using the rpm command. If you don't want to be obsessed with rpm dependencies all the time, you can manage rpm packages through yum combined with local sources. For the establishment of local sources, you can refer to another article by the author on yum.

Note: the above software packages can also be installed by compiling the source code, but the paths of many related files to be used need to be modified one by one according to the configuration of your source code installation.

(2) add users and groups needed for nagios to run:

# groupadd nagcmd # useradd-m nagios # usermod-a-G nagcmd nagios

Add apache to the nagcmd group so that you have sufficient permissions when operating nagios through web Interface:

# usermod-a-G nagcmd apache

3. Compile and install nagios:

# tar zxf nagios-3.1.2.tar.gz # cd nagios-3.1.2 #. / configure-- with-command-group=nagcmd # make all # make install # make install-init # make install-config # make install-commandmode

Specify the email address you want to use to receive nagios warnings for email, which is the local nagios user by default:

# vi / usr/local/nagios/etc/objects/contacts.cfg email nagios@localhost # this is the default setting

Create a Web program configuration file for Nagios in the configuration file directory (conf.d) of httpd:

# make install-webconf

Create a user who logs in to the nagios web program, which will be used later when logging in to nagios authentication through web:

# htpasswd-c / usr/local/nagios/etc/htpasswd.users nagiosadmin

You need to restart httpd after the configuration of the above process:

# service httpd restart

4. Compile and install nagios-plugins

All the monitoring of nagios is done through plug-ins, so you need to install official plug-ins for nagios before launching it.

# tar zxf nagios-plugins-1.4.13.tar.gz # cd nagios-plugins-1.4.13 #. / configure-- with-nagios-user=nagios-- with-nagios-group=nagios # make # make install

5. Configure and start Nagios

(1) add nagios as a system service and add it to the auto-start service queue:

# chkconfig-- add nagios # chkconfig nagios on

(2) check whether the syntax of its main configuration file is correct:

# / usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg

(3) if there is no problem with the above syntax checking, then you can officially start the nagios service:

# service nagios start

(4) configure selinux

If your system has the selinux service turned on, the nagios web cgi program is denied by default. You can check whether your system has selinux turned on with the following command:

# getenforce

If the result of the above command shows that the selinux service is turned on, you can temporarily turn it off with the following command:

# setenforce 0

If you want to shut down selinux completely in the future, you can change the value "force" after the selinux to "disable" by editing the / etc/sysconfig/selinux file.

Of course, you can also run nagios's CGI program in SELinux/targeted mode without closing selinux in the following ways:

# chcon-R-t httpd_sys_content_t / usr/local/nagios/sbin # chcon-R-t httpd_sys_content_t / usr/local/nagios/share

(5) View nagios: http://your_nagios_IP/nagios through the web interface

You need to specify the web authentication account and password set above when you log in.

Note: for the security of the nagios system, it is recommended that you use the information summary strong authentication mode (such as MD5), force the use of web's TSL/SSL secure communication mode, and set the client address that can access nagios's web interface through the access control list.

That's all for "how to install Nagios 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