Can cacti deal with unsigned SNMP v1 guages?
Moderators: Developers, Moderators
Can cacti deal with unsigned SNMP v1 guages?
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
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
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
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
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
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
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
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Surely there are lots of limitations. If you are aware of any, please post a feature requestrbecker 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*
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".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.
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
Reinhard( UNSIGN(A)*2^32) + UNSIGN(B) = result
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
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
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
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:
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
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
Now its time to go figure out scripts and see what I can put together in terms of a reasonable script.
Cheers
Ross
Who is online
Users browsing this forum: No registered users and 1 guest