nagios plugin working fine but in web it is giving different message
Hi,
i wrote a Plugin for the number of open files for a perticular process it is working fine when we give in the command in the libexec folder #./check_fd is working fine but when i use the command from the root #/usr/local/nagios/libexec/check_nrpe -H localhost -c check_fd it is giving the different message and the status also showing wrong if faced this type of problem tell me and how u rectified that problem pls tell me how to rectify this problem thanks in advance |
please check is your NRP service is running because it is checking through nrp?
if you have nagios user then nagios should have permission to execute the sript. and also the permissions for that script using other system commands etc. |
Hello and Welcome to LinuxQuestions,
The most important part of your question/problem is missing, namely, what's the error you get? If you want people to help you it's always very important to provide as much info as possible. Kind regards, Eric |
#!/bin/bash
USAGE="`basename $0` [-w|--warning]<percent free> [-c|--critical]<percent free>" THRESHOLD_USAGE="CRITICAL threshold must be greater than WARNING: `basename $0` $*" percent_free=/tmp/mempercent critical="" warning="" STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 # print usage if [[ $# -lt 4 ]] then echo "" echo "Wrong Syntax: `basename $0` $*" echo "" echo "Usage: $USAGE" echo "" exit 0 fi # read input while [[ $# -gt 0 ]] do case "$1" in -w|--warning) shift warning=$1 ;; -c|--critical) shift critical=$1 ;; esac shift done # verify input if [[ $warning -eq $critical || $warning -gt $critical ]] then echo "" echo "$THRESHOLD_USAGE" echo "" echo "Usage: $USAGE" echo "" exit 0 fi percent=`lsof -c java|wc -l {'print $1'}` if [[ "$percent" -gt $critical ]] then echo "CRITICAL - ($percent)no. of open files used by java" exit 2 fi if [[ "$percent" -gt $warning ]] then echo "WARNING - ($percent)no. of open files used by java" exit 1 fi if [[ "$percent" -le $warning ]] then echo "OK - ($percent)no. of open files used by java" exit 0 fi i wrote the above script and gave all permitions to it i placed it in the /usr/local/nagios/libexec and gave command ./check_fd -w 600 -c 700 i got out put ok- 594 no. of openfiles used by java . here the result is correct so then i went to the root there i gave #/usr/local/nagios/libexec/check_nrpe -H localhost -c check_fd i got 0k- 5 no. of openfiles used by java if i change the warning value and critical vale the message is not changing with this command #/usr/local/nagios/libexec/check_nrpe -H localhost -c check_fd but if go to the libexec folder the i gave the ./check_fd -w 500 -c 600 i got warning - 593 no. of openfiles used by java this the problem. |
Did you run the command as root or as nagios user and the same on both servers? On the Nagios server the commands are per default executed by the nagios user.
Kind regards, Eric |
i run the command as the root and as well as in nagios user there is no change in the out i checked in the nagios server also there also the same out pet is comming .
|
whats the output of ?
#/usr/local/nagios/libexec/check_nrpe -H localhost -c check_fd and check the configuration of nrpe, Verify that the command definition in your NRPE configuration file is correct. |
set the debug=1 in nrpe configuration file, restart the nrpe and see the log.
|
how to see the log ?
which log file i have to see? |
Log Files:
/var/log/syslog Set debug to 1 in : # vim /usr/local/nagios/etc/nrpe.cfg debug=1 open another terminal and execute: # tail -f /var/log/syslog then start querying the server with check_nrpe commands |
i check the log nothing is coming in that log
i want a new script for monitoring the number of open files for perticular process If any one wrote script pls paste that scipt here. |
|
i didn't find the plugin for the number of open files for particular process
there is a plugin for total no of open files in the system i don't want that i want for a particular process |
Hi,
If your script is working locally then you should be able to get it to work with Nagios too. Looking for another script will not solve any problem you have in communication between your Nagios server and the one you're monitoring. I'll put your script in my test server and Nagios and see what I get. If I encounter problems I'll try to fix them and post here. And please ask a mod to delete your 'double post'. You're not doing yourself any favors in double posting the same thing and worse if you do it in the same forum. Kind regards, Eric |
Hello sarathveera,
I just copied your script without changing anything on my Nagios server (since it has Java installed), set permissions to allow execute and owner to nagios:nagios and ran it as is. I got an error with this command: Code:
lsof -c java|wc -l {'print $1'} Code:
CRITICAL - (322)no. of open files used by java One tip though: change the output and usage description in your script because they are very confusing. For example if you execute the command without options to trigger the usage it states Code:
Wrong Syntax: openfiles Kind regards, Eric |
All times are GMT -5. The time now is 04:40 PM. |