I'm trying to write XML SNMP Query for getting counters value for interfaces with "Description".
The algorithm is the next:
1. Get fields "Description".
snmpwalk -c public -v 2c -On host_ip .1.3.6.1.4.1.35265.1.22.3.4.1.8
.1.3.6.1.4.1.35265.1.22.3.4.1.8.1.8.69.76.84.88.26.1.43.85 = STRING: "1/16"
.1.3.6.1.4.1.35265.1.22.3.4.1.8.1.8.69.76.84.88.26.1.69.84 = STRING: "COD"
.1.3.6.1.4.1.35265.1.22.3.4.1.8.2.8.69.76.84.88.26.1.9.48 = STRING: "1/11"
.1.3.6.1.4.1.35265.1.22.3.4.1.8.2.8.69.76.84.88.26.1.22.147 = STRING: "1/6/2"
.1.3.6.1.4.1.35265.1.22.3.4.1.8.2.8.69.76.84.88.26.1.142.127 = STRING: "1/13/2"
2. Get "oid_suffix".
Replace from "Description" oids string ".1.3.6.1.4.1.35265.1.22.3.4.1.8." (last ten octets)- then we get oid_suffix.
For example, for "1/13/2" we wil get: 2.8.69.76.84.88.26.1.142.127
3. Get counter value on oid = .1.3.6.1.4.1.35265.1.22.3.3.10.1.6. + oid_suffix + .7.1 .
For example, for "1/13/2" it would be:
snmpwalk -c public -v 2c -On host_ip .1.3.6.1.4.1.35265.1.22.3.3.10.1.6.2.8.69.76.84.88.26.1.142.127.7.1
.1.3.6.1.4.1.35265.1.22.3.3.10.1.6.2.8.69.76.84.88.26.1.142.127.7.1 = Gauge32: 2300720330
My XML SNMP Query draft:
Code: Select all
<query>
<name>ifDescr</name>
<description>Queries a traffic throw interface with Description</description>
<oid_index>.1.3.6.1.4.1.35265.1.22.3.4.1.8</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>
<index_order>ifDescr:ifIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<ifIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.35265.1.22.3.3.10.1.6.</oid>
<oid_suffix>7.1</oid_suffix>
</ifIndex>
</fields>
</query>