I need to query a specific OID using the value from another input as index, I understand that <rewrite_index> is an option for this.
In my code I am calling up to CPUIndexcpuPhysIndex from cpuName
Code: Select all
<interface>
<name>Cisco IOS XE cpu usage</name>
<description>Get CPU usage for IOS XE stacks</description>
<index_order_type>numeric</index_order_type>
<oid_index>.1.3.6.1.4.1.9.9.109.1.1.1.1.2</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]+)$</oid_index_parse>
<fields>
<CPUIndexcpuPhysIndex>
<name>CPU Index</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.9.9.109.1.1.1.1.2</oid>
</CPUIndexcpuPhysIndex>
<cpuName>
<name>Switch Name</name>
<method>get</method>
<source>value</source>
<direction>input</direction>
<rewrite_index>|query_CPUIndexcpuPhysIndex|</rewrite_index>
<oid>.1.3.6.1.2.1.47.1.1.1.1.7</oid>
</cpuName>
<cpuFiveSec>
<name>CPU usage 5 sec</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.9.9.109.1.1.1.1.6</oid>
</cpuFiveSec>
<cpuOneMin>
<name>CPU usage 1 min</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.9.9.109.1.1.1.1.7</oid>
</cpuOneMin>
<cpuFiveMin>
<name>CPU usage 5 min</name>
<method>get</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.9.9.109.1.1.1.1.8</oid>
</cpuFiveMin>
</fields>
</interface>
Data Query Debug Information
Total: 0.000000, Delta: 0.000000, Running data query [15].
Total: 0.000000, Delta: 0.000000, Found type = '3' [SNMP Query].
Total: 0.000000, Delta: 0.000000, Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/cisco_xe_cpu.xml'
Total: 0.000000, Delta: 0.000000, XML file parsed ok.
Total: 0.000000, Delta: 0.000000, <oid_num_indexes> missing in XML file, 'Index Count Changed' emulated by counting oid_index entries
Total: 0.040000, Delta: 0.040000, Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.9.9.109.1.1.1.1.2' Index Count: 2
Total: 0.040000, Delta: 0.000000, Index found at OID: '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.19' value: '1000'
Total: 0.040000, Delta: 0.000000, Index found at OID: '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.20' value: '2000'
Total: 0.040000, Delta: 0.000000, index_parse at OID: '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.19' results: '19'
Total: 0.040000, Delta: 0.000000, index_parse at OID: '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.20' results: '20'
Total: 0.040000, Delta: 0.000000, Located input field 'CPUIndexcpuPhysIndex' [get]
Total: 0.080000, Delta: 0.040000, Executing SNMP get for data @ '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.19' [value='1000']
Total: 0.110000, Delta: 0.040000, Executing SNMP get for data @ '.1.3.6.1.4.1.9.9.109.1.1.1.1.2.20' [value='2000']
Total: 0.110000, Delta: 0.000000, Located input field 'cpuName' [get]
Executing SNMP get for 2 oids
Got SNMP get result for data @ '.1.3.6.1.2.1.47.1.1.1.1.7.1000' [value=''] (index: 19)
Got SNMP get result for data @ '.1.3.6.1.2.1.47.1.1.1.1.7.2000' [value=''] (index: 20)
Total: 0.120000, Delta: 0.010000, Update data query sort cache complete
Total: 0.120000, Delta: 0.000000, Updated data query index ordering
Total: 0.160000, Delta: 0.040000, Update re-index cache complete
Total: 0.160000, Delta: 0.010000, Update graph data query cache complete
Total: 0.170000, Delta: 0.000000, Update data source data query cache complete
Total: 0.170000, Delta: 0.000000, Update data query cache complete
Total: 0.180000, Delta: 0.010000, Update poller cache from query complete
Total: 0.190000, Delta: 0.010000, Automation execute data query complete
Total: 0.190000, Delta: 0.000000, Plugin hooks complete
below the snmpget that should be the result of the query :
.1.3.6.1.2.1.47.1.1.1.1.7.1000 = STRING: "Switch 1"