this is obsolete doc -- see http://doc.nethence.com/ instead
Installing custom Nagios NRPE scripts
Disk usage custom script
Fetch your custom scripts e.g.,
cd ~/bin/
wget http://pbraun.nethence.com/scripts/net/omreport4nagios.ksh
wget http://pbraun.nethence.com/scripts/net/diskusage4nagios.bash
wget http://pbraun.nethence.com/scripts/net/check_mem.sh
wget http://pbraun.nethence.com/scripts/net/check_mem.sh.dist
chmod +x omreport4nagios.ksh
chmod +x diskusage4nagios.bash
chmod +x check_mem.sh
Creating custom NRPE plugins on the client
Create the plugin you want e.g. in KSH,
rpm -qa | grep ksh
cd /usr/lib64/nagios/plugins/
#cd /usr/lib/nagios/plugins/
Note. Yes, the output needs to be on one line.
Here's another one for RAM,
rpm -qa | grep ksh
cd /usr/lib64/nagios/plugins/
#cd /usr/lib/nagios/plugins/
vi check_mem.ksh
#!/bin/ksh
freem=`free -m`
total=`echo "$freem" | grep ^Mem | awk '{print $2}'`
used=`echo "$freem" | grep 'buffers/cache' | awk '{print $3}'`
percent=$(( $used * 100 / $total ))
#print Total memory: $total
#print Used memory: $used
#failed
if (( $percent > 92 )); then
print FAILED - $percent% used
exit 2
#warning
elif (( $percent > 79 )); then
print WARNING - $percent% used
exit 1
#all fine
else
print OK - $percent% used
exit 0
fi
chmod +x check_mem.ksh
Nagios Exchange plugins
Fetch additional plugins from Nagios Exchange,
cd /root/bin/
wget --no-check-certificate -O - "https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=4174&cf_id=24" > check_mem.sh
chmod +x check_mem.sh