Nagios Installation and Nrpe installation

Source: Internet
Author: User
Tags snmp

Nagios does not detect any specific numeric indication, such as the number of processes on the operating system, and it only describes the status of the four monitored objects: ok,warning,critical and unknown. As a result, we only need to focus on the warning and critical state thresholds of the magic species, and Nagios passes the thresholds to the plug-in, which is responsible for monitoring the specific objects and analyzing the results, which returns four state information

Different ways for Nagios to monitor different objects
Linux/unix:snmp,nrpe,send-nsca
Switch:snmp
Print:snmp
windows:snmp,nsclient++: It contains the functions of Nrpe,nsca

nrpe:0.0.0.0:5666
Need to install both Nrpe and Nagios plugins on Nagios and monitoring objects

Nsca
Passive mode, by which the monitoring object actively sends messages to Nagios

nsclient++: is a client that listens in 0.0.0.0:12489


Preparing for Nagios before installing
Install dependencies: (MySQL is required here because MySQL needs to be detected)
# yum-y Install httpd gcc glibc glibc-common gd gd-devel php php-mysql MySQL mysql-devel mysql-server

Create users and Groups
# Groupadd Nagcmd
# useradd-g Nagcmd Nagios
# passwd Nagios

Attaching a group to an Apache user
# usermod-a-G Nagcmd Apache

Compiling and installing Nagios
# tar zxf nagios-3.3.1.tar.gz
# CD nagios-3.3.1
#./configure--with-command-group=nagcmd--enable-event-broker
# make All
# make Install
# Make Install-init
# Make Install-commandmode
# Make Install-config
# Make Install-webconf

Create a user who logs on to the Nagios web
# htpasswd-c/usr/local/nagios/etc/htpasswd.user nagiosadmin

Start httpd When the above configuration is complete
# Service httpd Restart

Installing the Nagios plugin (Nagios detection relies entirely on a variety of plugins)
# tar zxf nagios-plugins-1.4.15.tar.gz
# CD nagios-plugins-1.4.15
#./configure--with-nagios-user=nagios--with-nagios-group=nagios
# make
# make Install


Add Nagios to the service and configure it to boot
# chkconfig--add Nagios
# chkconfig--level 345 Nagios on

Check that the configuration file syntax is correct
#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

Start Nagios
# service Nagios Start

Turn off SELinux or set label
# chcon-r-T Httpd_sys_content_t/usr/local/nagios/sbin
# chcon-r-T Httpd_sys_content_t/usr/local/nagios/share

At this point, Nagios's installation is complete and can be accessed via the Web Http://ip/nagios





Monitoring remote Linux hosts based on Nrpe
Nrpe is used to run the daemon of monitoring command on the remote server, it is used for the Nagios monitor side to trigger the detection command on the remote host based on the installation, and output the test result to the monitor side, the execution cost is much lower than SSL, the detection process does not need the account of the remote host, etc. So security is also higher than SSH

installation configuration is monitored

Add Nagios Users
# useradd-s/sbin/nologin Nagios

Nrpe relies on Nagios plugins and needs to be installed first
# tar zxf nagios-plugins-1.4.15.tar.gz
# CD nagios-plugins-1.4.15
#./configure--with-nagios-user=nagios--with-nagios-group=nagios
# make
# make Install

Installing Nrpe
# TAR-ZXVF Nrpe-2.12.tar.gz
# CD nrpe-2.12
#./configure--with-nrpe-user=nagios--with-nrpe-group=nagios--with-nagios-user=nagios--with-nagios-group=nagios --enable-command-args--enable-ssl
# make All
# Make Install-plugin
# Make Install-daemon
# Make Install-daemon-config


Configure Nrpe
# vim/usr/local/nagios/etc/nrpe.conf

Log_facility=daemon
Pid_file=/var/run/nrpe.pid
server_address=127.0.0.1, listener Address
server_port=5666
Nrpe_user=nagios
Nrpe_group=nagios
allowed_hosts=172.16.10.1; Nagios server address
Command_timeout=60
connection_timeout=300
Debug=0

command[cmd_name]=/usr/local/nagios/


Start Nrpe
#/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d

Defining a script for a service
vim/etc/rc.d/init.d/nrped


#!/bin/bash
#
# chkconfig:2345 88 12
# Description:nrpe DAEMON
#
. /etc/rc.d/init.d/functions

Nrpe=/usr/local/nagios/bin/nrpe
Nrpeconf=/usr/local/nagios/etc/nrpe.cfg

Case "$" in
Start
Echo-n "Starting NRPE daemon ..."
$NRPE-C $NRPECONF-D
echo "Done."
;;
Stop
Echo-n "stoping NRPE daemon ..."
Pkill-u Nagios Nrpe
echo "Done."
;;
Restart
$ stop
Sleep 1
$ start
;;
*)
echo "Usage: $ start|stop|restart"
;;
Esca
Exit 0



Server-side configuration (Nagios monitor side)

Installing Nrpe
# TAR-ZXVF Nrpe-2.12.tar.gz
# CD nrpe-2.12
#./configure--with-nrpe-user=nagios--with-nrpe-group=nagios--with-nagios-user=nagios--with-nagios-group=nagios --enable-command-args--enable-ssl
# make All
# Make Install-plugin

Detects if the connection between the monitored objects is available
# cd/usr/local/nagios/libexec/
#./check_nrpe-h 172.16.100.11
NRPE v2.12

Nagios Installation and Nrpe installation

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.