|
|
| Author |
Message |
gillins
Joined: 05 Oct 2006 Posts: 3
|
Posted: Mon Oct 16, 2006 11:40 am Post subject: Lookbehind assertions in oid_index_parse |
|
|
I have been trying to use the index parse portion of an xml file to get the unique information in an oid. I am tring to get the unknow system generated oid for each virtual server on a version 9 big ip. Walk of the oid .1.3.6.1.4.1.3375.2.2.10.2.3.1.1 returns the names of the virtual servers and also the rest of the oid value for each server. example
[root@netmon snmp_queries]# snmpwalk -v2c -c public 10.1.99.13 .1.3.6.1.4.1.3375.2.2.10.2.3.1.1
SNMPv2-SMI::enterprises.3375.2.2.10.2.3.1.1.7.86.73.80.95.71.69.77 = STRING: "VIP_GEM"
SNMPv2-SMI::enterprises.3375.2.2.10.2.3.1.1.8.86.73.80.95.73.79.67.77 = STRING: "VIP_IOCM"
SNMPv2-SMI::enterprises.3375.2.2.10.2.3.1.1.8.86.73.80.95.83.77.84.80 = STRING: "VIP_SMTP"
in the first value returned I am trying to just parse out the oid information after the 1.1 I have tested my regular expression out on the command line and get the expected results. regular expression : (?<=(1\.1))((\.\d+)+) applied to .1.3.6.1.4.1.3375.2.2.10.2.3.1.1.7.86.73.80.95.71.69.77 returns 7.86.73.80.95.71.69.77
The problem comes in that the "<" in my expression is being imterperted as part of an XML tag in my query. I have tried to escape the "<" with "<" but it does not seem to work correct.
Any ideas on how I can use the expression above. There may be a better expression to do what I need but I am not a expression expert and this is what I came up with.
Thanks,
scott |
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Mon Oct 16, 2006 1:14 pm Post subject: |
|
|
You may try replacing | Code: | | (?<=(1\.1))((\.\d+)+) | by | Code: | | (\.1\.3\.6\.1\.4\.1\.3375\.2\.2\.10\.2\.3\.1\.1)((\.\d+)+) | That's an ugly quick shot, but you might want to give it a try
Reinhard |
|
| Back to top |
|
 |
gillins
Joined: 05 Oct 2006 Posts: 3
|
Posted: Mon Oct 16, 2006 5:11 pm Post subject: |
|
|
| I have tried that it returns the whole oid including the static and dynamic porition. |
|
| Back to top |
|
 |
tgravvold
Joined: 16 Oct 2006 Posts: 19
|
Posted: Tue Oct 17, 2006 1:45 am Post subject: |
|
|
I've successfully created a regex that haandles this OID's, see http://forums.cacti.net/about16772.html for an example. The problem I seem to have is that the OID gets too long when the virtual server has a long name. You can also use the ip address as a OID index, but then you have no way of knowing the name of the server.
Here is the regex:
^.{33}(.*)
What this meens is:
* Match any character 33 times from the begining of the line.
* Enter pharantesis to create backreference.
* Match any character to the end of the line.
This will return any character of a line excapt the 33 first ones. You have to look at the php code to understand. Cacti uses regex replace and replaces the original OID with backreference 1 of the regex.
Best regards
Terje Gravvold |
|
| Back to top |
|
 |
gillins
Joined: 05 Oct 2006 Posts: 3
|
Posted: Mon Oct 23, 2006 10:42 am Post subject: This looks great |
|
|
Thanks,
Can you post your whole templates that you have done for a big ip v9 so I dont have to recreate the wheel.
thanks,
scott |
|
| Back to top |
|
 |
Jeeves_
Joined: 23 Oct 2006 Posts: 1
|
Posted: Mon Oct 23, 2006 2:46 pm Post subject: Re: This looks great |
|
|
| gillins wrote: | Thanks,
Can you post your whole templates that you have done for a big ip v9 so I dont have to recreate the wheel.
thanks,
scott |
Yes, please do! |
|
| Back to top |
|
 |
tgravvold
Joined: 16 Oct 2006 Posts: 19
|
|
| Back to top |
|
 |
|