Download the installation package
Cd/opt
wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
wget https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.0.tar.gz
Install dependent packages
Yum install-y gcc glibc make cmake glibc-common gd gd-devel php perl-devel mysql-server
Compiling and installing Nagios-plugins
cd/opt/nagios-plugins-2.1.2
./configure--prefix=/usr/local/nagios
Do && make install && echo $?
Compiling and installing Nrpe
cd/opt/nrpe-3.2.1
./configure--prefix=/usr/local/nagios--enable-command-args
Make all
#添加nagios用户
Make Install-groups-users
#安装
Make install
#添加主配置文件
Make Install-config
#配置xinetd
Make install-inetd
#设置nrpe管理命令
Make Install-init
#编译插件
Make Check_nrpe
#安装插件
Make Install-plugin
Configuration
#先备份
Cp/usr/local/nagios/etc/nrpe.cfg{,.bak}
#修改配置文件
Vim/usr/local/nagios/etc/nrpe.cfg
#将hda1改为sda1
command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
Start Nrpe
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
Server-side
#生成配置文件 (it is recommended that the CP cause configuration file be modified) (this is named after test, it is recommended to name the host name)
cd/usr/local/nagios/etc/servers/
Vim Test.cfg
# # HOST Definition#define host{use linux-server; Name of the host template to use; This host definition would inherit all variables is defined; In (or inherited by) the Linux-server host template definition. HOST_NAME Test #客户端主机名 alias test address client IP address}## HOST GROUP definition# define hostgroup{hostgroup_name test; The name of the HostGroup alias test; Long name of the group members test; Comma separated list of hosts that belong to this group}## service definition# define service{ Use Local-service; Name of service template to use HOST_NAME test service_description Root Pa Rtition Check_command check_local_disk!20%!10%!/} define service{use Local-service; Name of service template to use HOST_NAME study service_description Root P Artition Check_command check_local_disk!20%!10%!/} ...
Re-reading the configuration file
Systemctl Reload Nagios
Nagios Client Installation settings