Parsing SNMP-OID with suffix?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
sebastianw
Posts: 5
Joined: Tue Jul 31, 2007 4:24 am

Parsing SNMP-OID with suffix?

Post by sebastianw »

Hi,

I'm trying to measure the received BGP-Prefixes on a Cisco Router. I'm having trouble because I don't know exactly how to build the following in the SNMP XML:

The number of received prefixes is stored in a oid which has a suffix after the peer IP:

CISCO-BGP4-MIB::cbgpPeerAcceptedPrefixes.10.10.10.2.ipv4.unicast

or in numeric form:

.1.3.6.1.4.1.9.9.187.1.2.4.1.1.10.10.10.2.1.1

So the index would be 10.10.10.2 but with the additional suffix of .1.1 for ipv4 unicast

I now could use an oid_index_parse like this

Code: Select all

<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.1\.1)$</oid_index_parse>
to get the index, but then I can't use it to get the IP address, which would be

.1.3.6.1.2.1.15.3.1.7.10.10.10.2

Now when I use

Code: Select all

<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.1\.1$</oid_index_parse>
I could use it to get the IP address etc. but I would need to specify the .1.1 somewhere to get the oid for the received routes.

It seems to me that this is not possible, I think it would require something like this:

Code: Select all

<receivedRoutes>
<name>receivedRoutes</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.9.9.187.1.2.4.1.1</oid>
<suffix>.1.1</suffix>
</receivedRoutes>
The suffix would then be added to the index to get the final oid.

Is there a way to make this work? Am I missing something?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Currently, this is not a feature of cacti. But it was already asked for some few months ago.
Reinhard
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I think that this is not too hard to do. However, it's just about midnight :(

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
sebastianw
Posts: 5
Joined: Tue Jul 31, 2007 4:24 am

Post by sebastianw »

It would be really great if this feature would be implemented into cacti. :) I looked at the sourcecode but I don't think I fully understand it, else I would've implemented it myself.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

As I already told, there is at least one Feature Request for this. You may find it in the Feature Request Forum and add your statement
Reinhard
yuval_ba
Posts: 32
Joined: Mon Oct 13, 2008 6:19 am

Post by yuval_ba »

funny, I was just struggling with that exact problem when I came across this post :)

My solution is to use the index that includes the .1.1, and in order to get the peer address I use OID/REGEXP as source like this:

Code: Select all

<bgpPeerAddr>
        <name>Peer Address</name>
        <method>walk</method>
        <source>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.1\.1$</source>
        <direction>input</direction>
        <oid>.1.3.6.1.4.1.9.9.187.1.2.4.1.1</oid>
</bgpPeerAddr>
so far it seems to work fine.
I will post more details or the template once I test it a little bit.

PS
it's 4:25AM my local time when I write this, but for me it's the best time :)
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests