Multi-line answer for SNMP Data query

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Jiby
Posts: 6
Joined: Fri Aug 17, 2012 7:56 am

Multi-line answer for SNMP Data query

Post by Jiby »

Hi, I've been trying to create a SNMP data query for SAP traffic in ALU 7750, and the problem I'm facing is simple

Usually cacti walks the OID + some identifier of data and gets 1 row in return, and all is shiny in that pretty world.
But it seems SAP have no "proper" identifier as such, because it has svcId, sapPortId, sapEncapValue, none of them being unique, only the combined info makes it an "identifier" (don't know the right term for that)

So when cacti polls, it can't parse the multi-line answer. (getting me Nan in graphs because of "U" in Ds)

(usual query)$ snmpwalk -v2c -c community IPadress 1.3.6.1.2.1.2.2.1.16.35684352
IF-MIB::ifOutOctets.35684352 = Counter32: 2431305668

(mine) $ snmpwalk -v2c -c community IPadress 1.3.6.1.4.1.6527.3.1.2.4.3.6.1.12.100001
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.35717120.61 = Counter64: 6828968 <== the one I want
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36012032.209 = Counter64: 3488631469197
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.11 = Counter64: 0
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.12 = Counter64: 864184499376
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.41 = Counter64: 99254995351
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.43 = Counter64: 1744816596069
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.45 = Counter64: 691867
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.50 = Counter64: 41098053494
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.181 = Counter64: 0
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.182 = Counter64: 12506134764
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.36274176.183 = Counter64: 62310347
SNMPv2-SMI::enterprises.6527.3.1.2.4.3.6.1.12.100001.1342177295.0 = Counter64: 0

Is it possible to "specify" a little more to cacti ?
I looked in the docs, but the closest I found would be the "source" field in XML SNMP query and I don't know enough about cacti to go further.

Thx in advance !
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Multi-line answer for SNMP Data query

Post by BSOD2600 »

First, have you searched the forum for others who might have already made the script/templates?

Read the documentation in http://docs.cacti.net?

If all you want is that single OID, you could just use a data template specifying that single OID: 1.3.6.1.4.1.6527.3.1.2.4.3.6.1.12.100001.35717120.61. Although an snmp xml template would be the cleaner and more dynamic solution...
Jiby
Posts: 6
Joined: Fri Aug 17, 2012 7:56 am

Re: Multi-line answer for SNMP Data query

Post by Jiby »

Thank you for your quick answer.

I did check the doc and the forum , I often post as last resort ;)
Found the generic way to create snmp data query, with the assumption that the suffix identifying the device/connexion apart from the others is unique.

Problem is, I don't want just this OID, but a way to query only one connexion at a time to make cacti graph every single one it finds
so my problem actually is that I have no unique suffix for each SAP, just the three fields concatenated that do the trick (well, no trick yet)

To be safe i'll keep browsing the forums.

EDIT : found this : http://forums.cacti.net/viewtopic.php?f=21&t=35372
Little way down the road I solved "this" problem by indexing on a specific query I didn't use before, and using (correctly this time) a REGEXP to parse my index.

Now i'm wondering : I have an index in 3 fields : svcId.PortId.sapEncapValue, any of which can be accessed from an specific OID or by value:OID/REGEXP, which one is more interesting ? regexp would avoid a snmpwalk but walk would avoid a the cpu load ... is it relevant ?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Multi-line answer for SNMP Data query

Post by BSOD2600 »

Jiby wrote:Now i'm wondering : I have an index in 3 fields : svcId.PortId.sapEncapValue, any of which can be accessed from an specific OID or by value:OID/REGEXP, which one is more interesting ? regexp would avoid a snmpwalk but walk would avoid a the cpu load ... is it relevant ?
If the reindex method is set to 'Uptime Goes Backwards' then the snmpwalk and cpu hit on the device should be very infrequent and nothing to worry about. performance monitoring/baseline would give you a more definitive answer though.
Jiby
Posts: 6
Joined: Fri Aug 17, 2012 7:56 am

Re: Multi-line answer for SNMP Data query

Post by Jiby »

That's good !

Yet another question (hopefully the last one) : these SAPs show a "portId" which is the physical port index of the ifName. I'd like to see the ifName (explicit) in addition to the portId (which tells me nothing) but the ifName has as index only the portID where my current query contains svcId.portId.sapEncapValue.

sample : current query (index in green): (...).6527.3.1.2.4.3.6.1.12.40124.69730304.124
and ifname associated with it :
IF-MIB::ifName.69730304 = STRING: 2/1/16

I created a simple bash script that outputs the "2/1/16" when given the index "40124.69730304.124" , how do I get cacti to show the usual data from the snmpquery and add a column with the result from the script ? is it even possible ?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Multi-line answer for SNMP Data query

Post by BSOD2600 »

Jiby wrote:how do I get cacti to show the usual data from the snmpquery and add a column with the result from the script ? is it even possible ?
Only possible when using a data query template (for example SNMP - Interface Statistics), as Cacti will take that ifName and store it into the database to be used on the graph. Otherwise, going to require a plugin to custom collect and store the textual data required for graphing.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests