How to install Nagios Plugin on Linux
Login as root
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.2.tar.gz # tar -zxf nagios-plugins-2.0.2.tar.gz # cd nagios-plugins-2.0.2 # ./configure # make # make install # useradd nagios # chown nagios.nagios /usr/local/nagios # chown -R nagios.nagios /usr/local/nagios/libexec
Install nrpe
# yum install xinetd -y # yum install openssl-devel # cd /usr/local/src # wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz # tar -xzf nrpe-2.12.tar.gz # cd nrpe-2.12 # ./configure # make all # make install-plugin # make install-daemon # make install-daemon-config # make install-xinetd # sed -i 's/127.0.0.1/103.26.40.132/g' /etc/xinetd.d/nrpe # echo "nrpe 5666/tcp # Nagios Plugin NRPE" >> /etc/services # chkconfig xinetd on # service xinetd restart # sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1 103.26.40.132/g' /usr/local/nagios/etc/nrpe.cfg
add this into nrpe.cfg
If the server installed with qmail, please change with qmail on below line, if postfix, please change it ( this is for check_mailq command ):
command[check_mailq]=/usr/local/nagios/libexec/check_mailq -w 50 -c 100 -M qmail/postfix/exim command[check_swap]=/usr/local/nagios/libexec/check_swap -w 70% -c 50% # Check load average command[check_load]=/usr/local/nagios/libexec/check_stat -L -w 10,8,5 -c 20,18,15 # Check memory & swap usage command[check_mem]=/usr/local/nagios/libexec/check_stat -M -w 100,25 -c 100,50 # Check cpu usage command[check_cpu]=/usr/local/nagios/libexec/check_stat -C -w 99 -c 100 -s 5 # Check open files command[check_open_file]=/usr/local/nagios/libexec/check_stat -F -w 10000,250000 -c 15000,350000 # Check io disk on device sda1, sda3 and sda4 command[check_io]=/usr/local/nagios/libexec/check_stat -I -w 2000,600 -c 3000,800 -p sda1,sda3,sda4 -s 5 # Check processes command[check_procs]=/usr/local/nagios/libexec/check_stat -P -w 1000 -c 2000 # Check network usage on eth0 command[check_net]=/usr/local/nagios/libexec/check_stat -N -w 1000000 -c 1500000 -p eth0 -s 5 # Check socket usage command[check_socket]=/usr/local/nagios/libexec/check_stat -S -w 500 -c 1000 # Check uptime command[check_uptime]=/usr/local/nagios/libexec/check_stat -U -w 5 # Check CPU context switch command[check_ctxt]=/usr/local/nagios/libexec/check_stat -X -w 6000 -c 70000 -s 2
