Nagios + Nrpe Configuration Guide 1. Preface for system staff, monitoring various running statuses of servers is one of the tasks. for a small number of servers, manual observation is not a problem, but it is too troublesome for Server Clusters, so many people use some automation tools, such as scripts. But today we are introducing a very famous open-source project nagios. Nagios is just a monitoring platform. All monitoring tasks are completed by plug-ins, with a high degree of customization and good configuration. NRPE is a popular plug-in, monitors the running status of remote servers, including disk space, CPU load rate, and other customizable content. 2. Configure Nagios as a machine on which the nagios platform is installed and accept the information of other monitored servers. Environment: Install Centos according to this Guide. The installation directory is as follows: installing Nagios and plug-ins to/usr/local/nagios will be configured as the Web interface of Nagios to monitor several main services (such as CPU load and disk utilization) of the local system: http: // localhost/nagios/2.1 preparations should be confirmed that your server is installed: you can run the following command to install yum install httpdyum install gccyum install glibc-commonyum install GD-devel 2.2 to switch between the root user su-l and create a nagios account. logon password/usr/sbin/useradd nagiospasswd nagios creates a user group named nagcmd for WEB interfaces (mainly due to WEB permission issues ). Add both nagios users and apache users to this group. /Usr/sbin/groupadd nagcmd/usr/sbin/usermod-G nagcmd nagios/usr/sbin/usermod-G nagcmd apache 2.3 download the Nagios installation package mkdir ~ /Downloadscd ~ /Downloads download the latest version from http://www.nagios.org/download/. nagioscompile and install cd with nagios-plugins 2.4 ~ /Downloadstar xzf nagios-** .tar.gz cd nagios -*. /configure -- with-command-group = nagatemake allmake installmake install-initmake install-configmake install-commandmode 2.5 custom configuration editing/usr/local/nagios/etc/objects/contacts. modify the email address in the cfg configuration file, which is the address of the nagios system sending alarm. 2.6 configure the WEB interface to install the nagios WEB configuration file under the conf. d directory of Apache: make install-webconf to create a nagiosadmin user for logging on to the Nagios WEB interface. Write down the password you entered: htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin restart Apache service to make the settings take effect service httpd restart2.7 compile and install the Nagios plug-in cd ~ /Downloadstar xzf nagios-plugins-* .tar.gz cd nagios-plugins-* compile and install the plugin. /configure -- with-nagios-user = nagios -- with-nagios-group = nagiosmakemake install2.8 start Nagioschkconfig -- add nagioschkconfig nagios on to verify the Nagios sample configuration file/usr/local/nagios/ bin/nagios-v/usr/local/nagios/etc/nagios. if cfg does not report an error, you can start the Nagios service nagios start 2.9 to change SELiux settings. The red hat series system has SELINUX to enhance security. However, in some cases, this is very troublesome, you need to set up permissions here. If it is too troublesome, you can directly disable SE Linux. If SELinux is in the forced security mode, you need to first get enforce to make SELinux in the allowed mode set enforce 0. However, we recommend that you modify the file force target mode of SELINUX: chcon-R-t httpd_sys_content_t/usr/local/nagios/sbin/chcon-R-t httpd_sys_content_t/usr/local/nagios/share/2.10 login WEB interface now you can log on to http: // localhost/nagios/to view the service information of the Local Machine. Enter the username and password you just entered. At this point, the configuration of the nagios 3.0 NRPE plug-in has been basically completed. Now the monitoring machine has been configured, but the remote server requires a plug-in to contact the platform. Fortunately, open-source products are comprehensive, there is a ready-made NRPE plug-in that can monitor server disk space problems and CPU load problems in real time, in addition, you can customize the account su-l/usr/sbin/useradd nagiospasswd nagios 3.1 to download the nagios-plugins and nrpe plug-ins. Be sure to download the new version. Tar xzf nagios-plugins-1.4.6.tar.gzcd nagios-plugins-1.4.6. /configuremakemake install chown nagios. nagios/usr/local/nagios chown-R nagios. install xinetd in nagios/usr/local/nagios/libexec 3.3 because nrpe is loaded through the xinetd process, xinetd must be installed. xinetd is not installed in red hat by default. yum install xinetd 3.4 install NRPEtar xzf nrpe-2.8.tar.gzcd. /configuremake all make install-pluginmake install-daemonmake install-daemon-config make ins Tall-xinetd 3.5 edit the nrpe file and edit the/etc/xinetd. d/nrpe file. Add the IP addresses of your monitoring platform machines to the backend of the following line and separate them with spaces. Only_from = 127.0.0.1 <IP address of your monitoring machine> Add the nrpe port to the service: edit the/etc/service file. Remember to copy a service file for backup and add this line: nrpe 5666/tcp # NRPE3.6 start the xinetd service. Now xinetd can be started to enable the NRPE process to start normally. 3.7 when the verification service is started, we can use netstat-at | grep nrpe to verify whether the process is started. If the process is started normally, the following message is returned: tcp 0 0 *: nrpe *: * The LISTEN command also verifies that the NRPE process function is normal. Run the following command to verify that/usr/local/nagios/libexec/check_nrpe-H localhost returns the result: after the NRPE v2.8 3.8 creation command is complete, you need to configure the check_nrpe command. This template is consistent, just copy it: define command {command_name check_nrpecommand_line $ USER1 $/check_nrpe-H $ HOSTADDRESS $-c $ ARG1 $} is used to define the commands for monitoring hosts...