Page 4 of 5
Re: Services issues
Posted: Tue Feb 17, 2015 1:23 pm
by abrist
Well, I just ran the same command against two other boxes. All seem fine.
Re: Services issues
Posted: Tue Feb 17, 2015 2:41 pm
by imran_khan
Hello,
OK, so where is the issue?
Thanks,
Imran Khan.
Re: Services issues
Posted: Tue Feb 17, 2015 2:47 pm
by abrist
We are using the same script right? From the web page you linked?
How did you copy the script? (You could have issues with dos line endings, or a missing the shabang . . . or something?)
Could you post the script as an attachment - copy the file off of the server intact and attach it here.
Re: Services issues
Posted: Tue Feb 17, 2015 6:09 pm
by imran_khan
Hello,
Yes I am using same script. Please find the script file with this thread.
Thanks,
Imran Khan.
Re: Services issues
Posted: Wed Feb 18, 2015 3:52 pm
by cmerchant
I downloaded the file you had posted check_snmp_time.sh, and it had the following 4 lines missing from the bottom of the bash script:
Code: Select all
diff check_snmp_time.sh /usr/local/nagios/libexec/check_snmp_time.sh
153,157d152
<
< # The calls to the different functions.
< readargs "$@"
< checkvariables
< getandprintresults
please attach the following to the bottom of your check_snmp_time.sh
Code: Select all
# The calls to the different functions.
readargs "$@"
checkvariables
getandprintresults
None of the actual bash script functions would be invoked, and when I tested
your copy of the script, it would always return a zero return code.
Re: Services issues
Posted: Thu Feb 19, 2015 10:35 am
by Biju
I have checked and confirmed that the the below 4 lines are already there on check_snmp_time.sh
# The calls to the different functions.
readargs "$@"
checkvariables
getandprintresults
Its there on the file which imran_khan attached earlier as well. Please review the text again and let us know what else can be the issue.
Re: Services issues
Posted: Thu Feb 19, 2015 12:54 pm
by jdalrymple
Hi imran_khan,
I can confirm that negate is not working as we might expect it to with your check_snmp_time.sh script, however it does seem to work as we'd expect it to with most other plugins. I did discover what seems to be a functional workaround that won't require you to rework your script. Could you try to use negate in your check with a -t value of 5 or less? Something like this:
Code: Select all
[jdalrymple@localhost ~]$ ./negate -t 5 ~/check_snmp_time.sh -H 10.10.10.1 -C public -w 30 -c 60
In my lab negate itself times out and returns code 2 for the check. This might solve your issue as long as your hosts are expected to respond to an snmp query in a reasonable amount of time.
Re: Services issues
Posted: Mon Feb 23, 2015 11:35 am
by imran_khan
Hello,
Thanks for the reply.
I have tried to put –t with negate but still getting “No data returned from command” error. Please suggest me on the same.
[root@NAGIOS libexec]# ./negate -t 5 -u CRITICAL /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
No data returned from command
[root@NAGIOS libexec]# ./negate -t 3 -u CRITICAL /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
No data returned from command
[root@NAGIOS libexec]# ./negate -t 5 /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
No data returned from command
[root@NAGIOS libexec]# ./negate -t 3 /usr/local/nagios/libexec/check_snmp_time -H Server_IP -C Community_Name -w 30 -c 60
No data returned from command
Thanks,
Imran Khan.
Re: Services issues
Posted: Mon Feb 23, 2015 1:26 pm
by tgriep
Could you run this and post back the output?
Code: Select all
/usr/local/nagios/libexec/check_snmp_time -H <IP Address> -C <community> -w 30 -c 60 ; echo $?
Re: Services issues
Posted: Mon Feb 23, 2015 1:52 pm
by imran_khan
Hello,
Here is the output of check_snmp_time command.
[root@NAGIOS ~]# /usr/local/nagios/libexec/check_snmp_time -H IP Address -C Community -w 30 -c 60 ; echo $?
Time difference is less than 30 seconds: 0|diff=0
0
Thanks,
Imran Khan.