OID REGEX
Moderators: Developers, Moderators
OID REGEX
I am having a bit of trouble getting a poll that is returning alphanumeric data to graph. I believe all I have to do is strip off the character(s) and I should be all set. So I try using <source> and regex out all the fluff, just keeping the numerics that I need, unfortunately that is either not working, or I am doing something wrong to make it not work.
SNMP Query
----------------
snmpwalk -v1 -c public XXX.XXX.XXX.XXX .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10
iso.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.1 = STRING: "1365W"
iso.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2 = STRING: "1400W"
From The Debug Log
--------------------------
04/19/2005 10:05:33 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/19/2005 10:05:33 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
XML File
------------
<bcblademmOUTpowerrinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
<source>OID/REGEXP:.*([0-9]{1,4})</source>
</bcblademmOUTpowerrinuse>
SNMP Query
----------------
snmpwalk -v1 -c public XXX.XXX.XXX.XXX .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10
iso.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.1 = STRING: "1365W"
iso.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2 = STRING: "1400W"
From The Debug Log
--------------------------
04/19/2005 10:05:33 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/19/2005 10:05:33 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
XML File
------------
<bcblademmOUTpowerrinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
<source>OID/REGEXP:.*([0-9]{1,4})</source>
</bcblademmOUTpowerrinuse>
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Since it's a string, I would write a script using the script server process. I don't know if we have a regular expression replace function for OID results. I will send a link to the Lead Developer on this one.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Actually, what I think you are looking for is the "VALUE/REGEXP" syntax since you are trying to parse data out of the value, not the OID. See the SNMP query XML documentation for more details.
In short, try replacing "OID/REGEXP" with "VALUE/REGEXP" in your XML file and see if that works.
-Ian
In short, try replacing "OID/REGEXP" with "VALUE/REGEXP" in your XML file and see if that works.
-Ian
raX, thanks for pointing that out, I guess I missed what the documentation was saying.
So I have attemtped to use 'VALUE/REGEXP' to parse just the numerics out of: STRING: "1365W"
Unfortuantly I still can not get it to work. The following is what I have in the XML file, and other variations on the <source> that I have used.
<bcblademmOUTpowerinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:([0-9]{1,4}).$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
<source>VALUE/REGEXP:([0-9]{1,4})</source>
<source>VALUE/REGEXP:([0-9]{1,4}).*$</source>
<source>VALUE/REGEXP:^([0-9]{1,4})W$</source>
Any help is appreciated.
So I have attemtped to use 'VALUE/REGEXP' to parse just the numerics out of: STRING: "1365W"
Unfortuantly I still can not get it to work. The following is what I have in the XML file, and other variations on the <source> that I have used.
<bcblademmOUTpowerinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:([0-9]{1,4}).$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
<source>VALUE/REGEXP:([0-9]{1,4})</source>
<source>VALUE/REGEXP:([0-9]{1,4}).*$</source>
<source>VALUE/REGEXP:^([0-9]{1,4})W$</source>
Any help is appreciated.
- Aaron Jeskey
I think the following should work:
<source>VALUE/REGEXP:\d+</source>
That should only return a series of numbers...
<source>VALUE/REGEXP:\d+</source>
That should only return a series of numbers...
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Still no go
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: Host responded to SNMP
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] RECACHE: Processing 6 items in the auto reindex cache for XXX.XXX.XXX.XXX'.
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1365W
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.1, output: U
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
<bcblademmOUTpowerinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:\d+</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: Host responded to SNMP
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] RECACHE: Processing 6 items in the auto reindex cache for XXX.XXX.XXX.XXX'.
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1365W
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.1, output: U
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/25/2005 02:48:25 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
<bcblademmOUTpowerinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:\d+</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
Last edited by ajeskey on Mon Apr 25, 2005 6:13 pm, edited 2 times in total.
- Aaron Jeskey
Crap, well when you do figure it out, I've got a SNMP script that needs the same fix.
Maybe \d+ is only a Perl specific character class which Cacti does not support?. In that case, something like [0-9]* might work?
One of the Devs want to give us a little help on which Regex's would accomplish what we want?
Maybe \d+ is only a Perl specific character class which Cacti does not support?. In that case, something like [0-9]* might work?
One of the Devs want to give us a little help on which Regex's would accomplish what we want?
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Ok I think I am going nuts...
This is what I have in the XML
<bcblademmINdomain1max>
<name>Power Domain 1 Unit Max Watts</name>
<method>walk</method>
<source>VALUE/REGEXP:Bay [0-9]: ([0-9]{1,4})W$</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4</oid>
</bcblademmINdomain1max>
<bcblademmOUTdomain1max>
<name>Power Domain 1 Unit Max Watts</name>
<method>walk</method>
<source>VALUE/REGEXP:Bay [0-9]: ([0-9]{1,4})W$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4</oid>
</bcblademmOUTdomain1max>
On the input when I go to add the graphs I get this from the verbose output
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4'
+ Found item [bcblademmINdomain1max='1400'] index: 1 [from regexp value parse]
+ Found item [bcblademmINdomain1max='1400'] index: 2 [from regexp value parse]
This is what I get back in from the input portion of the poll
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: Bay 3: 1400W
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmDomain1Max, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4.2, output: U
I am wondering if my problem is that since its coming in as a string, and being striped down, is it not making its way to a friendlt int? I havnt really poked around in the code to see whats going on with it after the initial poll.
Oh and need I say, I absolutly HATE IBM for this.... but the blades are really nice
This is what I have in the XML
<bcblademmINdomain1max>
<name>Power Domain 1 Unit Max Watts</name>
<method>walk</method>
<source>VALUE/REGEXP:Bay [0-9]: ([0-9]{1,4})W$</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4</oid>
</bcblademmINdomain1max>
<bcblademmOUTdomain1max>
<name>Power Domain 1 Unit Max Watts</name>
<method>walk</method>
<source>VALUE/REGEXP:Bay [0-9]: ([0-9]{1,4})W$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4</oid>
</bcblademmOUTdomain1max>
On the input when I go to add the graphs I get this from the verbose output
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4'
+ Found item [bcblademmINdomain1max='1400'] index: 1 [from regexp value parse]
+ Found item [bcblademmINdomain1max='1400'] index: 2 [from regexp value parse]
This is what I get back in from the input portion of the poll
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: 1400W
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmPWRInUse, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2, output: U
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] WARNING: Result from SNMP not valid. Partial Result: Bay 3: 1400W
04/25/2005 07:03:21 PM - CMDPHP: Poller[0] Host[53] SNMP: v1: XXX.XXX.XXX.XXX, dsname: bcblademmDomain1Max, oid: .1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.4.2, output: U
I am wondering if my problem is that since its coming in as a string, and being striped down, is it not making its way to a friendlt int? I havnt really poked around in the code to see whats going on with it after the initial poll.
Oh and need I say, I absolutly HATE IBM for this.... but the blades are really nice
- Aaron Jeskey
<bcblademmOUTpowerinuse>
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:([0-9]{1,4}).*$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
That is the one that I am specificaly looking at to get graphing. Below is the graph that is returned. When I add an input in, usign teh same as above just changing the direction, the verbose output displays the correct response. (just didnt want anyone thinking he isn't going nuts. He is just stupid, so I wanted to add this in)
Oh and I guess I should note that the graph at least shows up now, but i still get the dreaded "nan"
<name>Power Domain(s) In Use</name>
<method>walk</method>
<source>VALUE/REGEXP:([0-9]{1,4}).*$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10</oid>
</bcblademmOUTpowerinuse>
That is the one that I am specificaly looking at to get graphing. Below is the graph that is returned. When I add an input in, usign teh same as above just changing the direction, the verbose output displays the correct response. (just didnt want anyone thinking he isn't going nuts. He is just stupid, so I wanted to add this in)
Oh and I guess I should note that the graph at least shows up now, but i still get the dreaded "nan"
- Attachments
-
- PowerDomain1.JPG (35.89 KiB) Viewed 14351 times
Last edited by ajeskey on Tue Apr 26, 2005 4:31 pm, edited 1 time in total.
- Aaron Jeskey
Starting to sound like the VALUE/REGEXP is broken or Cacti uses some other obscure regexs. I've got someone who tried messing around with the regexs too here and they didn't work.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
I sent a quick not to the author for comments.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Who is online
Users browsing this forum: No registered users and 3 guests