Data query regexp problem

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
georgek
Posts: 8
Joined: Tue Dec 16, 2008 6:21 am
Location: Russia
Contact:

Data query regexp problem

Post by georgek »

I have the oid

and .1.3.6.1.4.1.15181.101.1.4.4.1.6
snmpwalk .1.3.6.1.4.1.15181.101.1.4.4.1.6
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.1.1 = Counter32: 3
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.1.2 = Counter32: 5
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.1.3 = Counter32: 7
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.2.1 = Counter32: 1
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.2.2 = Counter32: 3
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.2.3 = Counter32: 9
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.1 = Counter32: 1
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.2 = Counter32: 2
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.3 = Counter32: 5
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.4 = Counter32: 7
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.5 = Counter32: 3
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.6 = Counter32: 6
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.1 = Counter32: 6
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.2 = Counter32: 2
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.3 = Counter32: 4
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.4 = Counter32: 7
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.5 = Counter32: 1
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.6 = Counter32: 5
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.7 = Counter32: 5
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.8 = Counter32: 8

My task is to get values which equal in the last .1
(example:
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.1.1 = Counter32: 3
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.2.1 = Counter32: 1
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.3.1 = Counter32: 1
SNMPv2-SMI::enterprises.15181.101.1.4.4.1.6.4.1 = Counter32: 6 )

I wrote data-query

<interface>
<name>test</name>
<oid_index>.1.3.6.1.4.1.15181.101.1.4.4.1.2</oid_index>
<oid_index_parse>OID/REGEXP:.1.3.6.1.4.1.15181.101.1.4.4.1.6.([0-9].[1])</oid_index_parse>
<index_order>Index</index_order>
<index_order_type>numeric</index_order_type>
<fields>
<Index>
<name>Index</name>
<source>index</source>
<direction>input</direction>
</Index>
<Value1>
<name>Value1</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.15181.101.1.4.4.1.6</oid>
</Value1>
</fields>
</interface>

But regexp do not work. Help please.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

read http://docs.cacti.net/manual:087

try something like...
<oid_index>.1.3.6.1.4.1.15181.101.1.4.4.1.6</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9][1])$</oid_index_parse>
georgek
Posts: 8
Joined: Tue Dec 16, 2008 6:21 am
Location: Russia
Contact:

Post by georgek »

I am sorry for an error, but the offered variant also does not work.

<interface>
<name>IQ</name>
<oid_index>.1.3.6.1.4.1.15181.101.1.4.4.1.2</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9][1])$</oid_index_parse>
<index_order>Index</index_order>
<index_order_type>numeric</index_order_type>
<fields>
<Index>
<name>Index</name>
<source>index</source>
<direction>input</direction>
</Index>
<iq_mdi_total_loss>
<name>iq_mdi_total_loss</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.15181.101.1.4.4.1.6</oid>
</iq_mdi_total_loss>
</fields>
</interface>

Result in attachment/
Attachments
result.txt
Result
(355.39 KiB) Downloaded 104 times
BorisL
Cacti User
Posts: 131
Joined: Sat Mar 31, 2007 9:21 am
Contact:

Post by BorisL »

Have you got some other OID (i.e. name for these counters or something), that full table has only .1 OID suffix?
If this table exists, you can use it as index and turn on method=get for .1.3.6.1.4.1.15181.101.1.4.4.1.2 effectively removing other counters from view.

Hiding index items on some logic condition is bad practice.
georgek
Posts: 8
Joined: Tue Dec 16, 2008 6:21 am
Location: Russia
Contact:

Post by georgek »

Thanks, I have troubleshot using <rewrite_index>
BorisL
Cacti User
Posts: 131
Joined: Sat Mar 31, 2007 9:21 am
Contact:

Post by BorisL »

georgek wrote:Thanks, I have troubleshot using <rewrite_index>
How? :)
georgek
Posts: 8
Joined: Tue Dec 16, 2008 6:21 am
Location: Russia
Contact:

Post by georgek »

In attachment.
Attachments
iq.xml
XML
(1.17 KiB) Downloaded 108 times
result.txt
Result
(3.82 KiB) Downloaded 113 times
BorisL
Cacti User
Posts: 131
Joined: Sat Mar 31, 2007 9:21 am
Contact:

Post by BorisL »

Aha, that can be done without rewrite_index, just oid_suffix.
georgek
Posts: 8
Joined: Tue Dec 16, 2008 6:21 am
Location: Russia
Contact:

Post by georgek »

Probably. While I will leave "as is"
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests