I built a basic bin file to run JStack and output the results. This scripts runs fine locally but when using NRPE, it fails horribly, even on the local machine. My guess is the "wc" the script is using is not traversing NRPE correctly and this is why it is failing. I have attached a sample of the script below:
Code: Select all
#!/bin/bash
for pid in $( ps -ef | grep java|grep mediaserver | awk '{print $2}')
do
a=`jstack -l $pid | grep "RTPReceiver" | wc -l`
if [ $a -ge 4 ];then
echo "OK - $a RTPReceiverHandles are running!!"
exit 0
else
echo "CRITICAL - $a RTPReceiverHandles are running!! Media Server Component will need to be restarted!!!"
exit 2
fi
done
"OK - 4 RTPReceiverHandles are running!!"
but when I run it with NRPE, even locally using ./check_nrpe -H localhost -c script comes back with:
"CRITICAL - 0 RTPReceiverHandles are running!! Media Server Component will need to be restarted!!!"
I am hoping someone has heard of this and has an easy fix. Thanks in advance for anyone reviewing this.