Services issues

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Services issues

Post by abrist »

Well, I just ran the same command against two other boxes. All seem fine.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

OK, so where is the issue?

Thanks,
Imran Khan.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Services issues

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post by imran_khan »

Hello,

Yes I am using same script. Please find the script file with this thread.

Thanks,
Imran Khan.
Attachments
check_snmp_time.txt
(3.66 KiB) Downloaded 325 times
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: Services issues

Post 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.
Biju
Posts: 1
Joined: Thu Feb 19, 2015 10:26 am

Re: Services issues

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Services issues

Post 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.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post 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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Services issues

Post 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 $?
Be sure to check out our Knowledgebase for helpful articles and solutions!
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

Re: Services issues

Post 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.
Locked