Page 1 of 2

Check_SNMP vs snmpwalk

Posted: Tue Mar 07, 2017 3:46 pm
by cgerow
I get different output from check_snmp than I do snmpwalk...

----------------------------------------------------------

/> /usr/lib64/nagios/plugins/check_snmp -H 192.168.1.1 -C ComString -o sysUpTime.0
SNMP OK - 76017933 | DISMAN-EVENT-MIB::sysUpTimeInstance=76017933

----------------------------------------------------------

/> snmpwalk -v 1 -c ComString 192.168.1.1 sysUpTime.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (76017937) 8 days, 19:09:39.37

----------------------------------------------------------

Is there a way to convert what check_snmp displays (timetick value only) to a human readable format (example: 8 days, 18:32:42.80)?
This is how Nagios used to display the information "x days, hh:mm:ss". I use this as more a visual than I do for an alert.

Nagios® Core™ Version 4.2.4
CentOS Linux release 7.3.1611 (Core) 64bit

System Check:
define host{
use generic-switch
host_name switch01
alias switch01
address 192.168.1.1
}

define service{
use generic-service
host_name switch01
service_description System - Uptime
check_command check_snmp!-C ComString -o sysUpTime.0
}

commands.cfg:
# 'check_snmp' command definition
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}

Thank you.

--

Re: Check_SNMP vs snmpwalk

Posted: Wed Mar 08, 2017 1:24 pm
by tmcdonald
They're reporting the same info, just in different formats. Short of modifying the check_snmp plugin directly, you would need to write a wrapper script which calls the check_snmp plugin, grabs the output, and converts the date itself.

Re: Check_SNMP vs snmpwalk

Posted: Sat Mar 25, 2017 4:07 am
by homer_2001
Same Problem for me. I have updated my System from Nagios 4.1.1 with Nagios-Plugins 2.0.2 under Ubuntu 14.04.
In this case all things looks good. There are the Timeticks and the Uptime in a human readable format. Without wrapper script or other things.
Now, with Ubuntu 16.04, Nagios 4.2.4. and Nagios-Plugins 2.1.4 only shown timeticks.
Is this a bug or a feature ? Can I go back to 2.0.2-plugins ?

regards
homer

Re: Check_SNMP vs snmpwalk

Posted: Mon Mar 27, 2017 10:33 am
by mcapra
You should be able to re-compile nagios-plugins 2.0.2.

Can you share the check_command as well as command definition that you're using for your SNMP checks? I'll see if I can replicate the problem between those 2 versions of nagios-plugins.

Re: Check_SNMP vs snmpwalk

Posted: Mon Mar 27, 2017 10:49 am
by avandemore
I have confirmed the newer plugin has different output. Just a guess but this may be related:

https://github.com/nagios-plugins/nagio ... issues/108

Re: Check_SNMP vs snmpwalk

Posted: Thu Apr 06, 2017 3:19 pm
by homer_2001
Hi, better late then never ….

command an service definitions:

# 'check_snmp' command definition
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}

define service{
use generic-service ;
host_name Datenserver;
service_description Uptime
check_interval 5
check_command check_snmp!-C public -l Uptime -o .1.3.6.1.2.1.25.1.1.0;
}

Output with Nagios-Plugins 2.2.0
Uptime OK 04-06-2017 16:39:35 0d 0h 4m 35s 1/3 SNMP OK - Uptime 114718

Output with Nagios-Plugins 2.0.2
Uptime OK 06-04-2017 16:59:04 33d 6h 30m 58s 1/3 SNMP OK - Uptime Timeticks: (231370) 0:38:33.70
Command and Sevicedefinitions are the same.

I have compiled the plugins 2.2.0 with the new check_snmp.c from github, but no success.

regards
homer_2001

Re: Check_SNMP vs snmpwalk

Posted: Thu Apr 06, 2017 5:47 pm
by dwhitfield
The suggestion was to compile 2.0.2 not 2.2.0. Was that a typo?

Re: Check_SNMP vs snmpwalk

Posted: Fri Apr 07, 2017 4:54 am
by homer_2001
I have compiled booth versions, the 2.0.2 and the 2.2.0.

2.0.2. works good, showing timeticks and human readable uptime. 2.2.0. shows only timeticks. Look at my previous mail, there are the outputs from booth versions.

regards
homer_2001

Re: Check_SNMP vs snmpwalk

Posted: Fri Apr 07, 2017 10:13 am
by dwhitfield
homer_2001 wrote: Can I go back to 2.0.2-plugins ?
Maybe this wasn't clear in the earlier comment, but the answer is yes. Is there a reason you are not doing that?

Re: Check_SNMP vs snmpwalk

Posted: Fri Apr 07, 2017 2:56 pm
by homer_2001
It is o.k. so. I was wondering about the less function in the new version.

many thanks
homer_2001