Can cacti deal with unsigned SNMP v1 guages?

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

Moderators: Developers, Moderators

Post Reply
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Can cacti deal with unsigned SNMP v1 guages?

Post by rbecker »

I found that some of my disk space counters have gone south; some of them on linux, some on Network Appliance.

I've gotten the linux working again, by moving away from the UCD disk counters to the HOST disk counters and multiplying by the HOST UnitSize.


Unfortunately, on the netapp side, things are a bit more complex.

Netapp only supports SNMP v1, and returns large values in the form of two unsigned gauges. I would like be able to combine those two values with a CDEF to get the real desired value.

Unfortunately, I'm not sure that snmpget or anything else actually understands an unsigned guage.

The following command:
"snmpget -v 1 -c mycommunity -m all -O n mynetapp NETWORK-APPLIANCE-MIB::dfLowTotalKBytes.1"

returns the following result:
.1.3.6.1.4.1.789.1.5.4.1.15.1 = INTEGER: -220299952

I can't seem to spot anything in cacti where I can tell it to treat an SNMP value as unsigned.

What I need to eventually do is fetch the low & the high, multiply the high by 2^32, and add the low, treating everything as unsigned.

Can I do all this with CDEFs, or am I going to need to drop it into a script to convert the signed values to unsigned before doing the math?


Cheers
Ross
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

My first try would be http://docs.cacti.net/node/227. Pure SNMP, fast and stuff. But never checked on a NetAPP.
To answer your question: doing math with a single DEF is easy. But combining two DEFs (low and high order) is tricky. Would work only for fixed position DEFs, because your CDEF would have to list the DEF's name verbosely.
If you are interested, I will lead you through creating such a CDEF, I already did it a few times.
Else and surely, a script would help.
Reinhard
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Post by rbecker »

Gandalf,
I'm not sure what you mean by "fixed position" DEFs. Do you mean non-indexed SNMP values? If that's what you mean, it seems like a cacti design limitation. *evilgrin*

I know I can do math in a CDEF, but converting a signed value to an unsigned value is either a typecast or dependent on a boolean IF to get the correct value. That's what I was asking if I can accomplish in a CDEF.

I would love a bit of help with that conversion, if I'm going to be able to take two indexed SNMP values, convert them, then combine the two within a CDEF. If not, I'll start working on a script & submit a feature request to be able to combine indexed SNMP values in CDEFs.

Basically I'd need to do the following:

if "A" & "B" are both indexed SNMP values, and UNSIGN() represents a function which converts a signed 32-bit int to an unsigned:

( UNSIGN(A)*2^32) + UNSIGN(B) = result


Oh, and once this is working (for graphing Netapp volume space) I'll happily put a pretty bow on it and upload it to the scripts and templates.


Ross
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

rbecker wrote:Gandalf,
I'm not sure what you mean by "fixed position" DEFs. Do you mean non-indexed SNMP values? If that's what you mean, it seems like a cacti design limitation. *evilgrin*
Surely there are lots of limitations. If you are aware of any, please post a feature request
I know I can do math in a CDEF, but converting a signed value to an unsigned value is either a typecast or dependent on a boolean IF to get the correct value. That's what I was asking if I can accomplish in a CDEF.
That's talked with a type-awra programming language as a background. Even if this sounds simple, you can't do so in a CDEF. But it is possible to mimic such a behaviour doing "real math".
To do so, it is of no importance whether data stems from indexed or non-indexed data. If you are interested in it, we may start a little walkthrough to get
( UNSIGN(A)*2^32) + UNSIGN(B) = result
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Well, the math is quite easy. Assume, the high order is given by the first Graph Item and the low order by the second one. In this case, the first DEF is a and the second DEF is b. Now, let's use them in the CDEF:
cdef=a,4294967296,*,b,+
In words:
Take value of a and 4294967296, multiply both.
Take the result and b, add both.
That's it.
To assure, that a and b are defined accordingly, create a Graph Template and add both data sources as Graph Item #1 and #2, respectively.
Add a Graph Item#3 and associate this one with your new CDEF.
Create a Graph referring to that Graph Template.
If in doubt, please visit the Graph just generated at Graph Management, switch to DEBUg and post the resulting "rrdtool graph" statement
Reinhard
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Post by rbecker »

Gandalf,
I wasn't worried about the math to combine high order & low order values.

I was worried about the "combining values" in a CDEF. Now that you've shown me how it can be done, it looks pretty easy.

Unfortunately, I'm finally coming to the conclusion that I really want to use a script and simply record the values I really want into the RRD in the first place.

I did finally succeed in converting a signed 32-bit value to unsigned with a CDEF. Here's the CDEF I put together:

Code: Select all

cdef=CURRENT_DATA_SOURCE,DUP,0,LT,EXC,DUP,-1,*,2147483648,+,EXC,IF
The downside is I'd need to do that to two separate values, AND combine them with the math you specified.... all to get the eventual value I want to graph... and it would be done for every data point. Better to use a script and get all the math out of the way once so I dont end up with incredibly complex and difficult to maintain CDEFs. (building CDEFs in cacti is rather tedious).

Now its time to go figure out scripts and see what I can put together in terms of a reasonable script.

Cheers
Ross
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

rbecker wrote:building CDEFs in cacti is rather tedious
Why? You simply can put the whole string into it in one single run, if you like.
But I understand, that you may prefer a script. See first link of my signature for some guidance.
Reinhard
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Post by rbecker »

Hrmm,
Is putting the CDEF in as a string a new feature in .87, or am I blind? I'm still running .86j and I don't see any way to do that- all I get in my browser is the clunky interface where I have to add each term to the CDEF manually....

Cheers
Ross
rbecker
Posts: 26
Joined: Mon Feb 12, 2007 6:17 pm
Location: Bay Area, CA

Post by rbecker »

OK, I'm blind. Just use the "custom string" to enter the whole thing at once.

I was just using that to enter constant terms, and it hadn't occurred to me that it had a different use.... I can be dense at times.


--Ross
Adain21
Posts: 1
Joined: Wed Nov 25, 2009 1:56 am
Contact:

Post by Adain21 »

Thanks for taking the time to help, I really apprciate it.
[url=http://www.secure-bytes.com/SNMP+Browser.php]SNMP Browser[/url]
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests