OID REGEX

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

OID REGEX

Post by ajeskey »

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>
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

So I have finaly realized that I was usign the enteirly wrong thing to parse the data coming back in to the poller.

Any suggestions on what I should be looking at? Is there any more information that could give anyone to figure out why the data is not making its way to the graph?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

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
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?
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

Awesome thanks.

I was starting to realize that, yes the functionality is there, but only for the OID. I am glad to have it validated that I am not going crazy!
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

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
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

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.
- Aaron Jeskey
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

I think the following should work:
<source>VALUE/REGEXP:\d+</source>

That should only return a series of numbers...
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

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>
Last edited by ajeskey on Mon Apr 25, 2005 6:13 pm, edited 2 times in total.
- Aaron Jeskey
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

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?
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

Got it

VALUE/REGEXP:([0-9]{1,4}).*$


Thanks for the help... Blade Center Graphs are under construction
- Aaron Jeskey
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

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
- Aaron Jeskey
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

<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"
Attachments
PowerDomain1.JPG
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
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

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.
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

The thing that is breaking my head is that it works as an "input" but not as an "output"
- Aaron Jeskey
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I sent a quick not to the author for comments.

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?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests