SNMP V2 Data Query

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

Moderators: Developers, Moderators

Post Reply
sforsythe
Posts: 6
Joined: Fri Jun 28, 2013 8:38 am

SNMP V2 Data Query

Post by sforsythe »

Referencing this old post, was very close to exactly what I needed, but still having issues
http://forums.cacti.net/viewtopic.php?f=21&t=43860
I am using Cacti 0.8.8a , on CentOS6.4

Here is my xml

Code: Select all

<interface>
   <name>Get IPRS Statistics</name>
   <description>Queries for Kemp IPRS statistics</description>
   <oid_index>.1.3.6.1.4.1.12196.12.2.1.1</oid_index>
   <index_order>iprsDesc</index_order>
   <oid_index_parse>OID/REGEXP:.*\.([0-9]*)$</oid_index_parse>

   <fields>
      <iprsIndex>
         <name>Index</name>
         <method>walk</method>
         <source>index</source>
         <direction>input</direction>
      </iprsIndex>
      <iprsDesc>
         <name>Description</name>
         <method>walk</method>
         <source>value</source>
         <direction>input</direction>
         <oid>.1.3.6.1.4.1.12196.12.2.1.11</oid>
      </iprsDesc>
      <iprsBytesOut>
         <name>Bytes out</name>
         <method>walk</method>
         <source>value</source>
         <direction>output</direction>
         <oid>.1.3.6.1.4.1.12196.12.2.1.16</oid>
      </iprsBytesOut>
   </fields>
</interface>
Note in the previous thread , it was suggested to use
<iprsIndex>
<name>Index</name>
<source>value</source>
<direction>index</direction>
</iprsIndex>
but I changed source:value to source: input as that seemed to be suggested here http://www.cacti.net/downloads/docs/htm ... y_xml.html , and added a Method: walk , as while during debug that seemed to be an error.

1. I create a new data query
Name: kemp
Description: kemp
XML Path: <path_cacti>/resource/snmp_queries/kemp2.xml
Data Input Method: Get SNMP Data (Indexed)

Get: "Successfully located XML file:
2. Create new device
Downed device Detection: SNMP Uptime
SNMP Version: 2
SNMP Community: public
SNMP Port: 161
SNMP Timeout: 5000
Max OID per get request: 10

Upon save, device is created, and successfully SNMP polled (shows SNMP Information on device screen)

3. Add Data Query to device
Status: Success (184 items, 92 Rows)
Verbose Query: (truncated, not showing all 92 rows )
+ Running data query [24].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/share/cacti/resource/snmp_queries/kemp2.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.12196.12.2.1.1' Index Count: 92
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.1' value: '0'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.2' value: '0'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.3' value: '1'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.5' value: '2'
...
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.91' value: '10'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.92' value: '10'
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.1' results: '1'
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.2' results: '2'
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.3' results: '3'
..
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.92' results: '92'
+ Inserting index data for field 'iprsIndex' [value='1']
+ Inserting index data for field 'iprsIndex' [value='2']
+ Inserting index data for field 'iprsIndex' [value='3']
..
+ Inserting index data for field 'iprsIndex' [value='92']
+ Located input field 'iprsDesc' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.12196.12.2.1.11'
+ Found item [iprsDesc='10.10.1.173:22 Masq 0'] index: 1 [from value]
+ Found item [iprsDesc='10.10.1.222:22 Masq 0'] index: 2 [from value]
+ Found item [iprsDesc='10.10.1.90:25 Masq 0'] index: 3 [from value]
...
+ Found item [iprsDesc='10.10.1.223:80 Masq 0'] index: 92 [from value]
... Looks Great so far

4. Add a Data Template
Data Template
Name: Kemp
Data Source
Name: |query_iprsDesc| - Bytes (check user per-data source value)
Data Input Method: Get SNMP Data (Indexed)
Data Source Active: Check
Data Source Item:
Internal Data Source Name: BytesOut
Min Value: 0
Max Value: U
Data Source Type: Counter
check "user per-data source value" for Index Type, Index Value, Output Type-ID
5. Create graph template
Title: |query_iprsDesc| - BytesOut
Use per-graph value checked

Added 1 Graph Template Item
Data Source: Kemp - (iprsBytesOut)

Graph Item Inputs shows:
Data Source [iprsBytesOut]

6. Data Queries -> Assocated Graph Templates -> Add
Name: kemp
Graph Template: kemp
check data source for iprsBytesOut
Add suggested Values
Data Template: BytesOut - |query_iprsDesc| --> Name
Graph Template: BytesOut - |query_iprsDesc| --> Title
save


7. I goto the device, "create graphs for this Host"
Capture.PNG
Capture.PNG (40.99 KiB) Viewed 1263 times
I select any random one, hit create

If we look at the graph, it doesn't seem to be populating the query_iprsDesc value
Capture3.PNG
Capture3.PNG (29.83 KiB) Viewed 1263 times
The same with the data source name, and if we look at details of the data source , it has no index value assigned
Capture4.PNG
Capture4.PNG (79.77 KiB) Viewed 1263 times
If we look at devices
Capture5.PNG
Capture5.PNG (11.78 KiB) Viewed 1263 times
We see there is one graph and one data source assigned, but status remains unknown, and no matter what level of debug I use, nothing in the Logs ever suggests it even looks at this host/data source on polling.


If I add any other standard data source (interface network traffic), the device is polled and a graph is generated for that data source, but nothing occurs for the other graph data source (missing rra and graph image)

The difference is snmp -v2c ... any suggestions on how to debug and find out why it is not firing?
Attachments
Capture2.PNG
Capture2.PNG (24.24 KiB) Viewed 1263 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: SNMP V2 Data Query

Post by BSOD2600 »

Given the appearance of the simple single valued index, I wouldnt recommend using the <oid_index_parse> stuff. It just further complicates things unnecessarily. Looking at the verbose output of the kemp2.xml, the index values do appear wrong too.
sforsythe
Posts: 6
Joined: Fri Jun 28, 2013 8:38 am

Re: SNMP V2 Data Query

Post by sforsythe »

BSOD2600 wrote:Given the appearance of the simple single valued index, I wouldnt recommend using the <oid_index_parse> stuff. It just further complicates things unnecessarily. Looking at the verbose output of the kemp2.xml, the index values do appear wrong too.
I only used one value for simplicity ... there are actually 4 values I will need

Code: Select all

+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.1' value: '0'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.2' value: '0'
+ Index found at OID: '1.3.6.1.4.1.12196.12.2.1.1.3' value: '1'
...
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.1' results: '1'
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.2' results: '2'
+ index_parse at OID: '1.3.6.1.4.1.12196.12.2.1.1.3' results: '3'
As I understand it, this is getting index = 1,2,3

There is not an OID that has "index" values, that is why I have to parse the OID itself. The first 4 lines above are showing the correct values for those OID's (0,0,1)
sforsythe
Posts: 6
Joined: Fri Jun 28, 2013 8:38 am

Re: SNMP V2 Data Query

Post by sforsythe »

Running the following manually gives
php cmd.php 77 877
POLLER: Poller[0] NOTE: There are no items in your poller for this polling cycle!

But there ARE graphs created for this device, there ARE data sources for device, etc ....

I've tried putting down to SNMP v1, no difference. Any suggestions on how to fix?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: SNMP V2 Data Query

Post by BSOD2600 »

anything in the poller cache for this device? Try rebuilding it.

you been messing around with 1 min polling per chance?
sforsythe
Posts: 6
Joined: Fri Jun 28, 2013 8:38 am

Re: SNMP V2 Data Query

Post by sforsythe »

There is no entry being generated for poller item ... is this a bug of using OID PARSE?

If I manually generate a poller_item entry in db using sql query ..... a graph now shows up!

I don't want to have to do that for 92 entries though
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: SNMP V2 Data Query

Post by BSOD2600 »

sforsythe wrote:I don't want to have to do that for 92 entries though
Nor should you have to.

Try deleting the data sources/graphs from this device for your Data Query so you're starting from a clean slate. From the 'create graphs for this host' screen, recreate the various items you want. Now check the poller cache if the items have been added. No errors in the cacti.log during this process?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests