Nagios server is giving wrong output
Posted: Thu Jul 06, 2017 9:03 am
HI team,
I want to monitor the tomcat heap memory for this i have created small script, while i am executing the script i am able to get the right output from remote server. The same script i am calling the check_nrpe i am not able to get the wrong out put for ex: if remote server out put is Critical , the nagios server output OK like this i am getting the wrong output.
The below is my script
#!/bin/bash
process=`ps -ef | grep java | grep -v grep | cut -f6 -d ' '| head -n 1`
max=`jmap -heap $process | grep MaxHeapSize | awk '{printf $4}' | tr -s "." " " | awk '{print $1}' | tr -s "(" " " | awk '{print $1}'`
if [ $max -gt 2000 ] ; then
echo "CRITICAL: $max"
exit 2
else
echo "OK: $max"
exit 0
fi
---------------------------------------------------------------------
I have given the in sudo file as
Defaults:nagios !requiretty
Defaults:nrpe !requiretty
nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_heap (I saved the script in check_heap)
I want to monitor the tomcat heap memory for this i have created small script, while i am executing the script i am able to get the right output from remote server. The same script i am calling the check_nrpe i am not able to get the wrong out put for ex: if remote server out put is Critical , the nagios server output OK like this i am getting the wrong output.
The below is my script
#!/bin/bash
process=`ps -ef | grep java | grep -v grep | cut -f6 -d ' '| head -n 1`
max=`jmap -heap $process | grep MaxHeapSize | awk '{printf $4}' | tr -s "." " " | awk '{print $1}' | tr -s "(" " " | awk '{print $1}'`
if [ $max -gt 2000 ] ; then
echo "CRITICAL: $max"
exit 2
else
echo "OK: $max"
exit 0
fi
---------------------------------------------------------------------
I have given the in sudo file as
Defaults:nagios !requiretty
Defaults:nrpe !requiretty
nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_heap (I saved the script in check_heap)