I'm a bit confused about how exactly to add stuff with NRPE to monitor local services on my remote hosts. I got the basics out of the way and I can already monitor the easy stuff like users, procs, swap etc. <br><br>More ambitiously, I wanted to monitor the status of my "pbs_mom" (Torque Scheduler daemon) on each node in my cluster. I found the script check_pbsmom.sh on the NagiosExchange (snippet below) and copied it to my /usr/local/nagios/libexec. <br>
<br>Then I added this line to my nrpe.cfg<br><br>command[check_pbsmom]=/usr/local/nagios/libexec/check_pbsmom<br><br>But then I don't seem to have much success.<br>remotehost>/usr/local/nagios/libexec/check_nrpe -H localhost -c check_pbsmom<br>
NRPE: Unable to read output<br><br>If I just run the shell script though it seems to be working<br>/usr/local/nagios/libexec/check_pbsmom.sh <br>PBS_MOM OK: Daemon is running. Host is listening.<br><br><br>What am I doing wrong here! I'm still a bit confused about the interaction between command.cfg on the monitoring machine and the nrpe.cfg on the remote host.<br>
<br>Any advice?<br><br>-- <br>Rahul<br><br>#!/bin/bash<br># SYNOPSIS<br># check_pbsmom [<TCP port>] [<TCP port>] ...<br>#<br># DESCRIPTION<br># This NAGIOS plugin checks whether: 1) pbs_mom is running and<br>
# 2) the host is listening on the given port(s). If no port<br># number is specified TCP ports 15002 and 15003 are checked.<br>#<br># AUTHOR<br># <a href="mailto:Wayne.Mallett@jcu.edu.au">Wayne.Mallett@jcu.edu.au</a><br>
<br>OK=0<br>WARN=1<br>CRITICAL=2<br>PATH="/bin:/sbin:/usr/bin:/usr/sbin"<br><br># Default listening ports are TCP 15004 and 42559.<br>if [ $# -lt 1 ] ; then<br> list="15002 15003"<br>else<br> list="$*"<br>
fi<br><br>if [ `ps -C pbs_mom | wc -l` -lt 2 ]; then<br> echo "PBS_MOM CRITICAL: Daemon is NOT running!"<br> exit $CRITICAL<br>else<br> for port in $list ; do<br> if [ `netstat -ln | grep -E "tcp.*:$port" | wc -l` -lt 1 ]; then<br>
echo "PBS_MOM CRITICAL: Host is NOT listening on TCP port $port!"<br> exit $CRITICAL<br> fi<br> done<br> echo "PBS_MOM OK: Daemon is running. Host is listening."<br> exit $OK<br>fi<br>
<br>