输出如下
*** Configuration summary for nrpe 2.8.1 05-10-2007 ***:
General Options:
-------------------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios
Review the options above for accuracy. If they look okay,
type 'make all' to compile the NRPE daemon and client.
可以看到NRPE的端口是5666,下一步是make all
|
输出如下
*** Compile finished ***
If the NRPE daemon and client compiled without any errors, you
can continue with the installation or upgrade process.
Read the PDF documentation (NRPE.pdf) for information on the next
steps you should take to complete the installation or upgrade.
|
输出如下
/usr/bin/install -c -m 644 sample-config/nrpe.xinetd /etc/xinetd.d/nrpe
|
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1
在后面增加监控主机的地址0.111,以空格间隔
}
|
# Local services
nrpe 5666/tcp # nrpe
|
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
|
[root@dbpi nrpe-2.8.1]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.8.1
|
# The following examples use hardcoded command arguments...
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_hda1
]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1
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
|
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
|
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
|
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_hda1
|
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs
|
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs
|
NRPE v2.8.1
|
########################################################################
#
# 2007.9.5 add by yahoon
# NRPE COMMAND
#
########################################################################
# 'check_nrpe ' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
|
command_name check_nrpe
定义命令名称为check_nrpe,在services.cfg中要使用这个名称.
|
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
这是定义实际运行的插件程序.这个命令行的书写要完全按照check_nrpe这个命令的用法.不知道用法的就用check_nrpe �Ch查看
|
define service{
host_name dbpi
被监控的主机名,这里注意必须是linux且运行着nrpe,而且必须是hosts.cfg中定义的
service_description check-load
监控项目的名称
check_command check_nrpe!check_load
监控命令是check_nrpe,是在commands.cfg中定义的,带的参数是check_load,是在nrpe.cfg中定义的
max_check_attempts 5
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups sagroup
}
|
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
|
define service{
host_name dbpi
service_description check-swap
check_command check_nrpe!check_swap
max_check_attempts 5
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups sagroup
}
|
vi /etc/init.d/nagios
将prefix=/usr/local/nagiosaa改为安装的目录/etc/init.d/nagios
|
# Local services
#nrpe 5666/tcp # nrpe
|
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
allowed_hosts=127.0.0.1,192.168.0.111
注意两个地址以逗号隔开
|
本文出自 “yahoon的小屋” 博客,谢绝转载!