Help needed! SNMP table with 2 indexes

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

Moderators: Developers, Moderators

Post Reply
Regedit
Posts: 5
Joined: Tue Feb 24, 2015 2:21 pm

Help needed! SNMP table with 2 indexes

Post by Regedit »

Hi guys, need your help!

I've recently started using SNMP queries to gather data. A lot to learn, it's been going well but I have run into a problem.

I have an SNMP table that has 2 indexes (see snmp_index1.PNG) where the index values for each OID are derived from (see snmp_index2.PNG)
I don't know how to create such a data query, that has uses 2 indexes? (see csv export column "F" Indexes (snmp_index3.PNG,)
When i run the query (attached in zip data_query_xml_and_verbose_debug.zip ) I get only 2 rows returned where i should have 4 (again see snmp_index2.PNG).
A verbose query output is attached (attached in zip data_query_xml_and_verbose_debug.zip)


What am I missing? Hoping someone can help!!
Attachments
data_query_xml_and_verbose_debug.zip
(14.08 KiB) Downloaded 71 times
snmp_index3.PNG
snmp_index3.PNG (66.72 KiB) Viewed 1670 times
snmp_index2.PNG
snmp_index2.PNG (6.61 KiB) Viewed 1670 times
snmp_index1.PNG
snmp_index1.PNG (4.2 KiB) Viewed 1670 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Help needed! SNMP table with 2 indexes

Post by BSOD2600 »

Cacti doesnt natively work with mutli-valued indexes. there are two hack workarounds.
1) use a regex in the snmp data query which will treat the entire set of values as the index. so in your case they'd be "1.1", "1.2", 2.1", etc.
2) write a php script server script, which will then correctly handle the query/parsing of the mutli valued indexes.
Regedit
Posts: 5
Joined: Tue Feb 24, 2015 2:21 pm

Re: Help needed! SNMP table with 2 indexes

Post by Regedit »

Thanks for confirming BSOD. I'm struggling to understand the use of OID index parser, do you know of any good resources tha explain how it works?

Regedit
Posts: 5
Joined: Tue Feb 24, 2015 2:21 pm

Re: Help needed! SNMP table with 2 indexes

Post by Regedit »



Figured it out. Well it's working, I might struggle explaining why it works if pressed :wink:

Data Query Debug Information
+ Running data query [12].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/var/www/html/resource/snmp_queries/xosFlowCounters.xml'
+ XML file parsed ok.
+ <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.6848.2.3.26.1.1' Index Count: 3
+ Index found at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.1.1' value: '1'
+ Index found at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.2.1' value: '2'
+ Index found at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.3.1' value: '3'
+ index_parse at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.1.1' results: '1.1'
+ index_parse at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.2.1' results: '2.1'
+ index_parse at OID: '1.3.6.1.4.1.6848.2.3.26.1.1.3.1' results: '3.1'
+ Inserting index data for field 'cbsVapIndex' [value='1.1']
+ Inserting index data for field 'cbsVapIndex' [value='2.1']
+ Inserting index data for field 'cbsVapIndex' [value='3.1']
+ Located input field 'cbsVapName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.6848.2.3.26.1.3'
+ Found item [cbsVapName='vsx_1'] index: 1.1 [from value]
+ Found item [cbsVapName='ids_1'] index: 2.1 [from value]
+ Found item [cbsVapName='nofw_1'] index: 3.1 [from value]

XML script
<interface>
<name>Crossbeam XOS Flow Table Counters</name>
<description>Get Crossbeam XOS NPM Current Flow Table Values</description>
<oid_index>.1.3.6.1.4.1.6848.2.3.26.1.1</oid_index>

<oid_index_parse>OID/REGEXP:.*\.([0-9]\.[0-9]{1,2})$</oid_index_parse>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<cbsVapIndex>
<name>Index</name>
<source>index</source>
<direction>input</direction>
</cbsVapIndex>

<cbsVapName>
<name>Name</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.6848.2.3.26.1.3</oid>
</cbsVapName>
...
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Help needed! SNMP table with 2 indexes

Post by BSOD2600 »

Nicely done :) you went with the first suggestion solution switch is splitting off the last 2 number groups and handing it to Cacti as the index to use.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests