SNMP XML Query Creates Only One Row

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

Moderators: Developers, Moderators

Post Reply
frank1340
Posts: 4
Joined: Thu Sep 01, 2011 10:56 am

SNMP XML Query Creates Only One Row

Post by frank1340 »

I am trying to get the data from this SNMP walk:


snmpwalk -v2c -c netop 128.205.250.5 .1.3.6.1.4.1.16856.1.4.3
SNMPv2-SMI::enterprises.16856.1.4.3.1.0 = INTEGER: 5420
SNMPv2-SMI::enterprises.16856.1.4.3.2.0 = INTEGER: 3403
SNMPv2-SMI::enterprises.16856.1.4.3.3.0 = INTEGER: 630
SNMPv2-SMI::enterprises.16856.1.4.3.4.0 = INTEGER: 2773
SNMPv2-SMI::enterprises.16856.1.4.3.5.0 = INTEGER: 2017
SNMPv2-SMI::enterprises.16856.1.4.3.6.0 = INTEGER: 1055
SNMPv2-SMI::enterprises.16856.1.4.3.7.0 = INTEGER: 962
SNMPv2-SMI::enterprises.16856.1.4.3.8.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.9.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.10.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.11.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.12.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.13.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.14.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.15.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.16.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.17.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.18.0 = INTEGER: 0
SNMPv2-SMI::enterprises.16856.1.4.3.19.0 = INTEGER: 0

Here is my query:

<interface>

<name>SNMP - Bradford </name>
<oid_index>.1.3.6.1.4.1.16856.1.4.3</oid_index>
<fields>
<myHosts>
<name>1</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.16856.1.4.3.1.0</oid>
</myHosts>
<myHosts1>
<name>2</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.16856.1.4.3.2.0</oid>
</myHosts1>

...and so on. Name and such is just debug code for now.

I only get one row. Why? How can I do this better?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: SNMP XML Query Creates Only One Row

Post by noname »

Though I don't know what sort of values you want to get from the device,
here is an example:

Code: Select all

<interface>

<name>SNMP - Bradford</name>
<oid_index>.1.3.6.1.4.1.16856.1.4.3</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]+)\.0$</oid_index_parse>

<fields>
        <BradfordIndex>
                <name>BradfordIndex</name>
                <source>value</source>
                <direction>index</direction>
        </BradfordIndex>

        <BradfordValue1>
                <name>BradfordValue1</name>
                <method>walk</method>
                <source>value</source>
                <direction>input</direction>
                <oid>.1.3.6.1.4.1.16856.1.4.3</oid>
                <oid_suffix>0</oid_suffix>
        </BradfordValue1>
</fields>

</interface>
Verbose Query:
XML file parsed ok.
Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.16856.1.4.3'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.1.0' value: '5420'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.2.0' value: '3403'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.3.0' value: '630'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.4.0' value: '2773'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.5.0' value: '2017'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.6.0' value: '1055'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.7.0' value: '962'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.8.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.9.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.10.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.11.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.12.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.13.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.14.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.15.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.16.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.17.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.18.0' value: '0'
Index found at OID: '.1.3.6.1.4.1.16856.1.4.3.19.0' value: '0'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.1.0' results: '1'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.2.0' results: '2'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.3.0' results: '3'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.4.0' results: '4'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.5.0' results: '5'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.6.0' results: '6'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.7.0' results: '7'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.8.0' results: '8'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.9.0' results: '9'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.10.0' results: '10'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.11.0' results: '11'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.12.0' results: '12'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.13.0' results: '13'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.14.0' results: '14'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.15.0' results: '15'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.16.0' results: '16'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.17.0' results: '17'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.18.0' results: '18'
index_parse at OID: '.1.3.6.1.4.1.16856.1.4.3.19.0' results: '19'
Located input field 'BradfordValue1' [walk]
Executing SNMP walk for data @ '.1.3.6.1.4.1.16856.1.4.3'
Found item [BradfordValue1='5420'] index: 1 [from value]
Found item [BradfordValue1='3403'] index: 2 [from value]
Found item [BradfordValue1='630'] index: 3 [from value]
Found item [BradfordValue1='2773'] index: 4 [from value]
Found item [BradfordValue1='2017'] index: 5 [from value]
Found item [BradfordValue1='1055'] index: 6 [from value]
Found item [BradfordValue1='962'] index: 7 [from value]
Found item [BradfordValue1='0'] index: 8 [from value]
Found item [BradfordValue1='0'] index: 9 [from value]
Found item [BradfordValue1='0'] index: 10 [from value]
Found item [BradfordValue1='0'] index: 11 [from value]
Found item [BradfordValue1='0'] index: 12 [from value]
Found item [BradfordValue1='0'] index: 13 [from value]
Found item [BradfordValue1='0'] index: 14 [from value]
Found item [BradfordValue1='0'] index: 15 [from value]
Found item [BradfordValue1='0'] index: 16 [from value]
Found item [BradfordValue1='0'] index: 17 [from value]
Found item [BradfordValue1='0'] index: 18 [from value]
Found item [BradfordValue1='0'] index: 19 [from value]
NOTICE
If you want to draw lines on the graph by using specific field (e.g. BradfordValue1),
you should set <direction> to "output" (not "input") for that field.
(And "output" field won't be shown in Verbose Query)

For details, please learn with these documents:
- SNMP Data Query Walkthrough
- HowTo: Data Query Templates
frank1340
Posts: 4
Joined: Thu Sep 01, 2011 10:56 am

Re: SNMP XML Query Creates Only One Row

Post by frank1340 »

Thanks for the help!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests