nagios配置方法总结
一: 安装完nagios后在 /usr/local/nagios/etc/objects/中定义 要监控的文件 (监控主机)
 [root@nagios-Server objects]# ls
commands.cfg  localhost.cfg  switch.cfg     test-001.cfg  timeperiods.cfg  |  这里的test.cfg ,test-001.cfg 是 配置文件对应的
contacts.cfg  printer.cfg    templates.cfg  test.cfg      windows.cfg      |   主机Nagios-client01  与 Nagios-client02
[root@nagios-Server objects]# 
上文中的 test.cfg test-001.cfg
[root@nagios-Server objects]# cat test.cfg
define host{
        use     linux-server
        host_name       Nagios-client01
        alias   Nagios-client01
        address 192.168.40.40
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     HTTP
        check_command   check_http
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     SSH
        check_command   check_ssh
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     check-load
        check_command   check_nrpe!check_load
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     check-disk-hda1
        check_command   check_nrpe!check_hda1
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     check-disk-hda3
        check_command   check_nrpe!check_hda3
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     total_procs
        check_command   check_nrpe!check_total_procs
}
define service{
        use     generic-service
        host_name       Nagios-client01
        service_description     PING
        check_command   check_ping!100.0,20%!500.0,60%
}
define service{
        use generic-service
        host_name       Nagios-client01
        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
}
[root@nagios-Server objects]#
[root@nagios-Server objects]# cat test-001.cfg
define host{
        use     linux-server
        host_name       Nagios-client02
        alias   Nagios-client02
        address 192.168.40.30
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     HTTP
        check_command   check_http
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     SSH
        check_command   check_ssh
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     check-load
        check_command   check_nrpe!check_load
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     check-disk
        check_command   check_nrpe!check_hda1
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     check-disk-hda3
        check_command   check_nrpe!check_hda3
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     total_procs
        check_command   check_nrpe!check_total_procs
}
define service{
        use     generic-service
        host_name       Nagios-client02
        service_description     PING
        check_command   check_ping!100.0,20%!500.0,60%
}
define service{
        use generic-service
        host_name       Nagios-client02
        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
}
[root@nagios-Server objects]#
----------------------------------------
第二 配置服务器端的command.cfg 该文件在 /usr/local/nagios/etc/objects/中
在这个文件中主要添加 nrpe command ,其次这个实例中没有添加对swap的监控,我们手动加入swap的监控参数。
[root@nagios-Server objects]# cat commands.cfg
配置完成后运行
[root@nagios-Server objects]# cat commands.cfg
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 3.2.0
#
# Last Modified: 05-31-2007
#
# NOTES: This config file provides you with some example command definitions
#        that you can reference in host, service, and contact definitions.
#      
#        You don't need to keep commands in a separate file from your other
#        object definitions.  This has been done just to make things easier to
#        understand.
#
###############################################################################

################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands.  They may or may not work on
# your system without modification.  As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }
# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
 
 
################################################################################
#
# SAMPLE HOST CHECK COMMANDS
#
################################################################################

# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
# 'check-host-alive' command definition
define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }
 

################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands.  They may or may not work on
# your system, as they must be modified for your plugins.  See the HTML
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE:  The following 'check_local_...' functions are designed to monitor
#        various metrics on the host that Nagios is running on (i.e. this one).
################################################################################
# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }

# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }

# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }

# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }

# 'check_local_swap' command definition
define command{
        command_name    check_local_swap
        command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
        }

# 'check_local_mrtgtraf' command definition
define command{
        command_name    check_local_mrtgtraf
        command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
        }

################################################################################
# NOTE:  The following 'check_...' commands are used to monitor services on
#        both local and remote hosts.
################################################################################
# 'check_ftp' command definition
define command{
        command_name    check_ftp
        command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
        }

# 'check_hpjd' command definition
define command{
        command_name    check_hpjd
        command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
        }

# 'check_snmp' command definition
define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }

# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }

# 'check_ssh' command definition
define command{
        command_name    check_ssh
        command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
        }

# 'check_dhcp' command definition
define command{
        command_name    check_dhcp
        command_line    $USER1$/check_dhcp $ARG1$
        }

# 'check_ping' command definition
define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }

# 'check_pop' command definition
define command{
        command_name    check_pop
        command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
        }

# 'check_imap' command definition
define command{
        command_name    check_imap
        command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
        }

# 'check_smtp' command definition
define command{
        command_name    check_smtp
        command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
        }

# 'check_tcp' command definition
define command{
        command_name    check_tcp
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
        }

# 'check_udp' command definition
define command{
        command_name    check_udp
        command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
        }

# 'check_nt' command definition
define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
        }
# 'check_nrpe' command definition
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
# 'check_swap' command definition
define command{
        command_name    check_swap
        command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
        }

################################################################################
#
# SAMPLE PERFORMANCE DATA COMMANDS
#
# These are sample performance data commands that can be used to send performance
# data output to two text files (one for hosts, another for services).  If you
# plan on simply writing performance data out to a file, consider using the
# host_perfdata_file and service_perfdata_file options in the main config file.
#
################################################################################

# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
        }

# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
#       command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
        command_line    /usr/bin/perl /usr/local/nagios/sbin/insert.cgi
        }
[root@nagios-Server objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 看有无报错。
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL
Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/test.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/test-001.cfg'...
   Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
        Checked 16 services.
Checking hosts...
        Checked 2 hosts.
Checking host groups...
        Checked 0 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 1 contacts.
Checking contact groups...
        Checked 1 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...
        Checked 0 host escalations.
Checking host dependencies...
        Checked 0 host dependencies.
Checking commands...
        Checked 26 commands.
Checking time periods...
        Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors:   0
Things look okay - No serious problems were detected during the pre-flight check
总结:在服务器端主要配置两个文件 一:/usr/local/nagios/etc/objects/ 中的 要监控的主机  二:在/usr/local/etc/objects/command.cfg 文件中,添加如nrpe, swap 命令的支持
还有一个nrpe文件的配置,后面将会讲到。
------------------------------------------------------------------------------------------------------
配置被监控端
在被监控端安装 nagios-plugin ,nrpe后 在/usr/local/nagios/etc/ 中会有nrpe.cfg 这个文件
这个文件要做好,相关配置,信息如下:
有三个地方要注意
1 "server_address=0.0.0.0"
2 "allowed_hosts=127.0.0.1,192.168.40.30,192.168.40.40,192.168.40.50"
3 "command[check_hda3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda3"
   "command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10% "
后来添加的监控对象在这里要做策略
[root@nagios-client01 nagios]# cat /usr/local/nagios/etc/nrpe.cfg
#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad (nagios@nagios.org)
#
# Last Modified: 11-23-2007
#
# NOTES:
# This is a sample configuration file for the NRPE daemon.  It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################

# LOG FACILITY
# The syslog facility that should be used for logging purposes.
log_facility=daemon
 
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
pid_file=/var/run/nrpe.pid
 
# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
server_port=5666
 
# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
server_address=0.0.0.0
 
# NRPE USER
# This determines the effective user that the NRPE daemon should run as. 
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_user=nagios
 
# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as. 
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_group=nagios
 
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address.  I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
allowed_hosts=127.0.0.1,192.168.40.30,192.168.40.40,192.168.40.50
 

# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option. 
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=0
 
# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don't give
# random users write access to that directory or its contents!
# command_prefix=/usr/bin/sudo
 
# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
debug=0
 
# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
command_timeout=60
 
# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.
connection_timeout=300
 
# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
#allow_weak_random_seed=1
 
# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.
#include=<somefile.cfg>
 
# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>
 
# COMMAND DEFINITIONS
# Command definitions that this daemon will run.  Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on!  The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory.  Also note that you will have to modify the definitions below
# to match the argument format the plugins expect.  Remember, these are
# examples only!

# 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
command[check_hda3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda3
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'.  This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.
#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
[root@nagios-client01 nagios]#
启动nrpe
[root@nagios-client01 nagios]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg
察看:
[root@nagios-client01 nagios]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State     
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:680                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     
tcp        0      0 :::22                       :::*                        LISTEN     
[root@nagios-client01 nagios]# netstat -an |grep 5666
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN     
[root@nagios-client01 nagios]#
-------------------------------------------------------------
总结:文件配置的顺序 (当然这个不是死的可以灵活来的,针对我自己而言)首先配置服务器端的
1 /usr/local/nagios/etc/objects/中创建  要检测的主机 其实就是写一个文件
2 /usr/local/nagios/etc/ 中修改 nagios.cfg ,主要做的就是 添加 要检测的主机 及第一步中设置的文件 比如 :
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/test.cfg     ---------这个文件就是在第一步中建立的东西 要检测的主机
cfg_file=/usr/local/nagios/etc/objects/test-001.cfg ---------还有这个也是
# Definitions for monitoring the local (Linux) host
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
3 /usr/local/nagios/etc/commands.cfg 文件中添加相关命令,这里我是用的nrpe,还有一个swap的命令,看如上的配置中会有。
“说明下 在服务器端 要安装的 有 nagios 主程序,nagios-plgins ,nrpe 好了继续”
4 现在配置 “被监控端” 在被监控端 要安装 nagios-plgins,nrpe 后 会有 /usr/local/nagios/ 这个目录
定义nrpe.cfg
在被监控端  要配置好 在监控端 要监控的东西,比如我们添加了对 swap ,hda1 ,hda3
在nrpe.cfg中要定义好(/usr/local/nagios/etc/nrpe.cfg)
在这个文件中要修改的地方有3个 一是 “server_address” 二是 “allowed_hosts” 第三 后添加的 监控对象 看如上的配置中会有。
“command[check_hda3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda3”
“command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10% ”
修改完后 重启下nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg
察看下状态
[root@nagios-client01 etc]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State     
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:680                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     
tcp        0      0 :::22                       :::*                        LISTEN     
[root@nagios-client01 etc]#