Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Sep 21, 2018 7:35 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: <rewrite_index> issue
PostPosted: Wed Sep 12, 2018 5:24 pm 
Offline
Cacti User

Joined: Sun Feb 26, 2017 10:33 am
Posts: 73
Hi Everyone,

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:
<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>


This is the outcome :

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"


Top
 Profile  
 
 Post subject: Re: <rewrite_index> issue
PostPosted: Thu Sep 13, 2018 5:37 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1435
I've posted a reply on GitHub to your issue #1921 giving a brief breakdown on how the function works.

_________________
Cacti Resources:
Cacti Website
Cacti Issues
Cacti Releases

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: <rewrite_index> issue
PostPosted: Thu Sep 13, 2018 6:41 am 
Offline
Cacti User

Joined: Sun Feb 26, 2017 10:33 am
Posts: 73
thanks,

I also replied on Github, we can follow up there and update here in case at the end


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group