Installing NRPE Using the Install Script You must run the following commands as root.
For CentOS & RHEL 5-7, Fedora 14+, SLES & OpenSUSE 11+, Ubuntu 12+, Debian 6+:
1 wget http:// assets.nagios.com/downloads/ nagiosxi/agents/ linux-nrpe-agent.tar.gz
Unpack the installer, and run the install script:
1 2 3 tar xzf linux-nrpe-agent.tar .gz cd linux-nrpe-agent ./fullinstall
The script takes care of the following setup:
Installs prerequisite packages
Creates required users and groups
Defines services for xinetd
Compiles and installs the NRPE agent and Nagios plugins
Configures the firewall (except on SLES)
Configures the agent
The script will stop to prompt you once to ask for the IP address(es) for your monitoring server(s).
You will need to type either a single address or multiple addresses separated by spaces. This will configure the xinetd superdaemon to allow connections from those addresses to the NRPE agent.
You now have NRPE installed. You may remove any installation files in the tmp directory.
Nagios监控Linux主机内部信息
监控端安装软件
1 2 3 4 5 6 7 8 wget -O nagioscore.tar.gz https://gi thub.com/NagiosEnterprises/ nagioscore/archive/ nagios-4.4 .3 .tar.gz wget --no-check-certificate -O nagios-plugins.tar.gz https://gi thub.com/nagios-plugins/ nagios-plugins/archive/ release-2.2 .1 .tar.gz wget http:// assets.nagios.com/downloads/ nagiosxi/agents/ linux-nrpe-agent.tar.gz
被监控端安装软件
1 2 wget http:// assets.nagios.com/downloads/ nagiosxi/agents/ linux-nrpe-agent.tar.gz
被监控端配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 log_facility =daemonpid_file =/var/run/nrpe.pidserver_port =5666 nrpe_user =nagiosnrpe_group =nagiosallowed_hosts =127.0 .0.1 dont_blame_nrpe =1 debug =0 command_timeout =60 connection_timeout =300 include_dir =/usr/local/nagios/etc/nrpecommand[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/sda2command[check_zombie_procs] =/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Zcommand[check_total_procs] =/usr/local/nagios/libexec/check_procs -w 150 -c 200
监控端配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 define command { command_name check_nrpe command_line $USER1 $/check_nrpe -H $HOSTADDRESS $ -c $ARG1 $ } define host { use linux-server host_name host123 alias My Linux Server address 192.168.23.123 } define service { use generic-service host_name host123 service_description check host alive check_command check-host-alive } define service { use generic-service host_name host123 service_description check users check_command check_nrpe!check_users } define service { use generic-service host_name host123 service_description Load check_command check_nrpe!check_load } define service { use generic-service host_name host123 service_description check sda2 check_command check_nrpe!check_hda1 } define service { use generic-service host_name host123 service_description check zombie procs check_command check_nrpe!check_zombie_procs } define service { use generic-service host_name host123 service_description check total procs check_command check_nrpe!check_total_procs } cfg_file =/usr/local/nagios/etc/objects/192.168.23.123.cfg
验证配置
1 /usr/ local/nagios/ bin/nagios -v /u sr/local/ nagios/etc/ nagios.cfg
重启服务
1 systemctl restart nagios