I'm using the exec functionality of netsnmp to import data into zen from
servers.. It seems that at least with 2.1.0 values returned as String type from
SNMP are not cast to integer or float when the reach MinMaxThreshold.
from snmpwalk ::
.1.3.6.1.4.1.2021.8.1.101.1 = STRING: 0
RRD seems to graph this well enough, but when I go to set a min max thresh it
always exceeds the value because of the way python seems to evaluate string vs
int comparison
>>> "0" > 5
True
2007-11-28 10:15:30 INFO zen.MinMaxCheck: Checking proxy_errors_count 0 against
min None and max 5
2007-11-28 10:15:30 INFO zen.MinMaxCheck: 0
2007-11-28 10:15:30 INFO zen.MinMaxCheck: <type 'str'>
2007-11-28 10:15:30 INFO zen.MinMaxCheck: 5
2007-11-28 10:15:30 INFO zen.MinMaxCheck: <type 'int'>
The debugging bits to help ::
def checkRange(self, dp, value):
'Check the value for min/max thresholds'
log.info("Checking %s %s against min %s and max %s",
dp, value, self.minimum, self.maximum)
if value is None:
return []
thresh = None
if self.maximum is not None and value > self.maximum:
log.info(value)
log.info(type(value))
log.info(self.maximum)
log.info(type(self.maximum))
.....
I'm not quite sure I'd call this a bug since netsnmp is returning a string..
and that's what python is treating it as.. but it certainly wasn't what I was
expecting given that the graphs were able to deal with the values. I'm also
not sure the best way to fix it? I'd be wary of casting all snmp values to
float/ints but at the same time.. a string isn't very useful for a min/max
calculation. Any ideas?
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=13787#13787
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users