Check_SNMP vs snmpwalk

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Check_SNMP vs snmpwalk

Postby cgerow » Tue Mar 07, 2017 3:46 pm

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.

--
Thank you,
CG

--
User avatar
cgerow
 
Posts: 1
Joined: Tue Mar 07, 2017 3:03 pm

Re: Check_SNMP vs snmpwalk

Postby tmcdonald » Wed Mar 08, 2017 1:24 pm

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.
Former Nagios employee
tmcdonald
 
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_SNMP vs snmpwalk

Postby homer_2001 » Sat Mar 25, 2017 4:07 am

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
homer_2001
 
Posts: 5
Joined: Sat Mar 25, 2017 4:02 am

Re: Check_SNMP vs snmpwalk

Postby mcapra » Mon Mar 27, 2017 10:33 am

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.
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3601
Joined: Thu May 05, 2016 3:54 pm

Re: Check_SNMP vs snmpwalk

Postby avandemore » Mon Mar 27, 2017 10:49 am

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
Previous Nagios employee
avandemore
 
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Check_SNMP vs snmpwalk

Postby homer_2001 » Thu Apr 06, 2017 3:19 pm

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
homer_2001
 
Posts: 5
Joined: Sat Mar 25, 2017 4:02 am

Re: Check_SNMP vs snmpwalk

Postby dwhitfield » Thu Apr 06, 2017 5:47 pm

The suggestion was to compile 2.0.2 not 2.2.0. Was that a typo?
Need additional support for CentOS or ubuntu? Try OpenLogic: https://www.openlogic.com/talk-to-expert

We can write Nagios plugins for you!

We are hiring: https://www.perforce.com/careers
dwhitfield
Former Nagios Staff
 
Posts: 4582
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: Check_SNMP vs snmpwalk

Postby homer_2001 » Fri Apr 07, 2017 4:54 am

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
homer_2001
 
Posts: 5
Joined: Sat Mar 25, 2017 4:02 am

Re: Check_SNMP vs snmpwalk

Postby dwhitfield » Fri Apr 07, 2017 10:13 am

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?
Need additional support for CentOS or ubuntu? Try OpenLogic: https://www.openlogic.com/talk-to-expert

We can write Nagios plugins for you!

We are hiring: https://www.perforce.com/careers
dwhitfield
Former Nagios Staff
 
Posts: 4582
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: Check_SNMP vs snmpwalk

Postby homer_2001 » Fri Apr 07, 2017 2:56 pm

It is o.k. so. I was wondering about the less function in the new version.

many thanks
homer_2001
homer_2001
 
Posts: 5
Joined: Sat Mar 25, 2017 4:02 am

Next

Return to Community Support

Who is online

Users browsing this forum: argis, gormank, UTE-COT and 22 guests