Nagios Remote Monitoring

Source: Internet
Author: User

1. Add Users

[Email protected] ~]# Useradd Nagios
2. Installing Nagios-plugins

[Email protected] ~]# tar zxf nagios-plugins-2.0.3.tar.gz
[Email protected] nagios-plugins-2.0.3]#/configure--with-nagios-user=nagios--with
--with-apt-get-command:
--with-ping6-command:/bin/ping6-n-u-w%d-c%d%s
--with-ping-command:/bin/ping-n-u-w%d-c%d%s
--with-ipv6:yes
--with-mysql:/usr/bin/mysql_config
--with-openssl:yes
--with-gnutls:no
--enable-extra-opts:yes
--with-perl:/usr/bin/perl
--enable-perl-modules:no
--with-cgiurl:/nagios/cgi-bin
--with-trusted-path:/bin:/sbin:/usr/bin:/usr/sbin
--enable-libtap:no
[[email protected] nagios-plugins-2.0.3]# make && make install

[Email protected] nagios]# pwd
/usr/local/nagios
[Email protected] nagios]# chown-r Nagios.nagios *

3. Installing NRPE

[Email protected] ~]# tar zxf nrpe-2.15.tar.gz

[Email protected] nrpe-2.15]#./configure

General Options:
-------------------------
NRPE port:5666
NRPE User:nagios
NRPE Group:nagios
Nagios User:nagios
Nagios Group:nagios

[[email protected] nrpe-2.15]# make all

4. Installing plugins, daemon, and sample configuration files

#安装nrpe-plugin Plug-in
[email protected] nrpe-2.15]# make Install-plugin

#安装nrpe Daemon

[email protected] nrpe-2.15]# make Install-daemon
#安装daemon配置文件

[email protected] nrpe-2.15]# make Install-daemon-config

#安装xinetd脚本, NRPE Daemon is running as a service under XINETD, so install the xinetd first.

[email protected] nrpe-2.15]# Yum install-y xinetd

[email protected] nrpe-2.15]# make install-xinetd

4. Modify the configuration file

[Email protected] nrpe-2.15]# Vim/etc/xinetd.d/nrpe #添加nagios服务端的地址

Only_from = 172.25.16.2 #nagios Host IP address

[Email protected] ~]# vim/usr/local/nagios/etc/nrpe.cfg

allowed_hosts=172.25.16.2 #允许监测主机的IP

5. Edit the/etc/services file to add the Nrpe service

Nrpe 5666/tcp #nrpe

6. Restart the service

[Email protected] nrpe-2.15]#/etc/init.d/xinetd restart

[Email protected] nrpe-2.15]# NETSTAT-ANTLP | grep 5666 #NRPE已经启动
TCP 0 0::: 5666:::* LISTEN 22872/xinetd


#在监控主机上

1. Install Nrpe, only need Check_nrpe plug-in, can directly from the monitored side copy

[Email protected] libexec]# SCP Check_nrpe 172.25.16.2:/usr/local/nagios/libexec/

[Email protected] libexec]# chown Nagios.nagios Check_nrpe
[email protected] libexec]# ll Check_nrpe
-rwxr-xr-x. 1 Nagios nagios 76769 23:36 Check_nrpe
[Email protected] libexec]#/check_nrpe-h 172.25.16.3 #输出nrpe的版本 to establish a connection between the monitoring machine Check_nrpe and the Nrpe daemon of the monitored host operation
NRPE v2.15
[Email protected] libexec]# vim/usr/local/nagios/etc/objects/commands.cfg

# ' Check_nrpe '
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C "$ARG 1$" #-c The parameters are passed to the monitored end Nrpe daemon to execute the monitoring command, these commands in NRPE.CFG requirements have been defined

}
[Email protected] ~]# grep-v ' ^# '/usr/local/nagios/etc/nrpe.cfg | Sed '/^$/d '
Log_facility=daemon
Pid_file=/var/run/nrpe.pid
server_port=5666
Nrpe_user=nagios
Nrpe_group=nagios
allowed_hosts=172.25.16.2
Dont_blame_nrpe=0
Allow_bash_command_substitution=0
Debug=0
Command_timeout=60
connection_timeout=300
Command[check_users]=/usr/local/nagios/libexec/check_users-w 5-c 10
Command[check_load]=/usr/local/nagios/libexec/check_load-w 15,10,5-c 30,25,20
Command[check_disk]=/usr/local/nagios/libexec/check_disk-w 20%-C 10%-P/
Command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs-w 5-c 10-s Z
Command[check_total_procs]=/usr/local/nagios/libexec/check_procs-w 150-C 200

[Email protected] libexec]# Vim/usr/local/nagios/etc/objects/services.cfg # The service commands defined in this definition are completely based on the built-in commands in the monitored end nrpe.cfg, as shown in the command above

Define Service{
Use Generic-service
HOST_NAME server3.example.com
Service_description CPU Load
Check_command Check_nrpe!check_load
}
Define Service{
Use Generic-service
HOST_NAME server3.example.com
Service_description Current Users
Check_command check_nrpe!check_users
}

Define Service{
Use Generic-service
HOST_NAME server3.example.com
Service_description/free Space
Check_command Check_nrpe!check_disk
}
Define Service{
Use Generic-service
HOST_NAME server3.example.com
Service_description Total Processes
Check_command Check_nrpe!check_total_procs
}

Define Service{
Use Generic-service
HOST_NAME server3.example.com
Service_description Zombie Processes
Check_command Check_nrpe!check_zombie_procs
}

#监测是否有语法错误并测试

[Email protected] libexec]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
[Email protected] objects]#/usr/local/nagios/libexec/check_nrpe-h 172.25.16.3-c check_load

Ok-load average:0.08, 0.02, 0.01|load1=0.080;15.000;30.000;0; load5=0.020;10.000;25.000;0; load15=0.010;5.000;20.000;0;

[Email protected] objects]#/usr/local/nagios/libexec/check_nrpe-h 172.25.16.3-c check_users
Users OK-1 users currently logged in |users=1;5;10;0

This article is from the "8397752" blog, please be sure to keep this source http://8407752.blog.51cto.com/8397752/1701452

Nagios Remote Monitoring

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.