Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


be more flexable with oid/regex output in XML files
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests
Author Message
sodium



Joined: 01 Feb 2006
Posts: 24

PostPosted: Tue Jun 20, 2006 8:55 am    Post subject: be more flexable with oid/regex output in XML files Reply with quote

I have seen several MIB's where an index is used to point to other locations in the mib with a little extension (of 2 numbers)

example: (juniper mib)

.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.14.<index>.<peer_index_#>

and now you have to use <index> on the info you want but now with an addition of 2 numbers

like:

.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.7.<peer_index_#>.1.1
.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.8.<peer_index_#>.1.1
.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.9.<peer_index_#>.1.1
.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10.<peer_index_#>.1.1

if we could use back references from regex in XML like this:

<interface>
<name>Juniper - BGP Peer Prefix Stats</name>
<oid_index>.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.14</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.1\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.([0-9]{1,2})$</oid_index_parse>
<index_order>Index</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<Index>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2636.5.1.1.2.6.2.1</oid>
</Index>

<jnxBgpM2PrefixInPrefixes>
<name>Prefixes In</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.7.$3.1.1</oid>
</jnxBgpM2PrefixInPrefixes>
<jnxBgpM2PrefixInPrefixesAccepted>
<name>Accepted Prefixes</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.8.$3.1.1</oid>
</jnxBgpM2PrefixInPrefixesAccepted>
<jnxBgpM2PrefixOutPrefixes>
<name>Outbound Prefixes</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10.$3.1.1</oid>
</jnxBgpM2PrefixOutPrefixes>
</fields>
</interface>

I do not have to do this in a seperate perl script...

and the Centillion MIB has the same problem -- so I think it's more common....
Back to top
twelzy
Cacti User


Joined: 30 Mar 2005
Posts: 74
Location: BRAZIL/Brasilia

PostPosted: Wed Jun 21, 2006 4:09 pm    Post subject: Reply with quote

Hi sodium!

That's one of the features that I requested in 'Improve the "power" of REGEXPs in Data Queries' (http://forums.cacti.net/viewtopic.php?t=13949)!
(No answer until now...)

Still waiting...

(And sorry for my poor English...)
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Thu Jun 22, 2006 9:27 am    Post subject: Reply with quote

I don't know how we can make it "better", as we are using the regex functions that PHP provides.
Back to top
sodium



Joined: 01 Feb 2006
Posts: 24

PostPosted: Thu Jun 22, 2006 11:34 am    Post subject: Reply with quote

rony wrote:
I don't know how we can make it "better", as we are using the regex functions that PHP provides.


to implement this:

<oid>.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10.$regs[3].1.1</oid>

it's simple regex 'back reference' stuff (it's available in PHP see http://nl2.php.net/manual/en/ref.regex.php )
Back to top
danbeck



Joined: 20 Jun 2006
Posts: 30
Location: Huntsville, Alabama

PostPosted: Thu Jun 22, 2006 5:04 pm    Post subject: Reply with quote

rony wrote:
I don't know how we can make it "better", as we are using the regex functions that PHP provides.


How about using the preg functions instead of POSIX only?
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Thu Jun 22, 2006 5:18 pm    Post subject: Reply with quote

danbeck wrote:
rony wrote:
I don't know how we can make it "better", as we are using the regex functions that PHP provides.


How about using the preg functions instead of POSIX only?


Without looking at the source code, I don't recall what it uses..
Back to top
twelzy
Cacti User


Joined: 30 Mar 2005
Posts: 74
Location: BRAZIL/Brasilia

PostPosted: Thu Jun 22, 2006 7:10 pm    Post subject: Reply with quote

Hi sodium, rony and danbeck,

The actual regexp functions used in <CACTI_PATH>/lib/data_query.php file are POSIX Regular Expressions.

I think that both POSIX Regular Expressions functions and PCRE (Perl-Compatible Regular Expression) functions could resolve this issue.

The problem here is that with the actual <CACTI_PATH>/lib/data_query.php file we can't do:
    - "VALUE/REGEXP" in the <oid_index_parse> field, with the possibility to match more than one value and use these values in the <source> field;
    - "VALUE/REGEXP" in the <source> field, with the possibility to match and use these values;
    - "VALUE/REGEXP_REPLACE" in the <source> field, with the possibility to match and replace more than one value.
In a previous post of mine (http://forums.cacti.net/viewtopic.php?t=13949) I give this example:
Quote:
Example: Internet Links in our Border Routers

We have 2 kinds of agreements in our Internet Links: transit and peering links.
And we classify these links in 2 categories: national and international links.
These classifications are shortened in the ifAlias as following:

(TRANS|PEER)_(NAC|INTL)_.*

We have here 2 input fields: AGGREMENT and NATIONALITY.
So we need to match and replace:

TRANS by Transit, in the AGGREMENT input field;
PEER by Peering, in the AGGREMENT input field;
NAC by National, in the NATIONALITY input field;
INTL by International, in the NATIONALITY input field,

respectively!
In this case, we need a "VALUE/REGEXP_REPLACE" in the <source> field, with the possibility to match and replace more than one value!

And if we want to make a Data/Graph template that will list only these Internet links of our Border Routers, we need a "VALUE/REGEXP" in the <oid_index_parse> field, that matches only the ifAlias that begin with (TRANS|PEER)!

I'm not a PHP expert. I have 6 years of experience in shell scripting. Now I'm studing PHP to convert my shell scripts to PHP scripts.
rony, if you need some help to write/test the code I can dedicate some of my time to this task.

Thanks in advance!
(And sorry for my poor English...)
Back to top
twelzy
Cacti User


Joined: 30 Mar 2005
Posts: 74
Location: BRAZIL/Brasilia

PostPosted: Thu Jun 29, 2006 3:04 pm    Post subject: Reply with quote

Any feedback...?!

Thanks in advance!
(And sorry for my poor English...)
Back to top
sodium



Joined: 01 Feb 2006
Posts: 24

PostPosted: Mon Jul 10, 2006 4:10 am    Post subject: Reply with quote

The silence is deafining...
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Tue Jul 11, 2006 9:28 pm    Post subject: Reply with quote

It's just that the developers are indisposed at the moment. I can't seem to get any time for Cacti lately. I hope that changes soon....

TheWitness
Back to top
sebastianw



Joined: 31 Jul 2007
Posts: 5

PostPosted: Mon Aug 13, 2007 4:13 am    Post subject: Reply with quote

Hi! I also asked for a feature like that in

http://forums.cacti.net/viewtopic.php?t=22586

I use Cacti with Cisco routers and I would greatly benefit from a feature which would let me use a suffix for some OIDs (see my original post for an example).
Back to top
sh0x



Joined: 30 Aug 2007
Posts: 14

PostPosted: Wed Sep 12, 2007 11:06 am    Post subject: Reply with quote

I could use this feature as well. I'm finding this to be a common issue with many Cisco OIDs and would imagine its the same for other vendors MIBs as well.

For example I'm trying to poll frame-relay statistics and my indexes are:

14.100
14.200
19.100
19.200


Then I poll a bunch of OIDs and one of my OIDs adds a .1 to the end so I can't poll that particular OID.

14.100.1
14.200.1
19.100.1
19.200.1


I'm finding this more of an issue when I try to reference another OID for a descriptive information. I'm new to regex though. Can I do a regex to ignore the .1 if it exists, but to still work if it doesn't have a .1?

Thanks,
sh0x
Back to top
Syngress



Joined: 24 Apr 2007
Posts: 13

PostPosted: Tue Oct 09, 2007 3:21 am    Post subject: Reply with quote

Hi,

I am having the same issue as the original poster in that the OID I want use has a suffix to the index

http://forums.cacti.net/viewtopic.php?t=23596 is where I posted my original issue, any idea if this will get fixed as a lot of our new network equipment (Juniper & Foundry) use these sort of OID's.

Syngess
Back to top
Ragnar



Joined: 04 Aug 2005
Posts: 5

PostPosted: Thu Nov 15, 2007 3:55 pm    Post subject: Reply with quote

also requesting this feature, we have quite a few pieces of hardware (Cisco routers, MetaSwitch softswitch) where the developers have suffixed an OID, instead of prefixing into a table like they should have...

Anyone have a workaround/patch for this? We only have a single digit to deal with on the end (.1 = current 5 mins, .2 = prev 5 mins, .3 = current 15 mins, etc), my cacti-fu is weak though, unless it's hacking together composite bandwidth graphs...

Sample of snmpwalk output of the OID's I'm trying to graph:
Code:

$ grep '.1.1.1.1 = ' isupdeststatisticswalk.txt
METASWITCH-MIB::iSUPRemSigDestStatsNumCircsCfgd.1.7.100.101.102.97.117.108.116.1.1.1.1 = Gauge32: 432
METASWITCH-MIB::iSUPRemSigDestStatsNumCircsAvail.1.7.100.101.102.97.117.108.116.1.1.1.1 = Gauge32: 432
METASWITCH-MIB::iSUPRemSigDestStatsNumCircsInUse.1.7.100.101.102.97.117.108.116.1.1.1.1 = Gauge32: 108


1.7.100.101.102.97.117.108.116.1.1.1 is the index, grabbed from a different portion of the MIB.
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Thu Nov 15, 2007 4:15 pm    Post subject: Reply with quote

Does anyone have a patch? It won't make it into Saturday's release, but...

TheWitness
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group