On Sunday 18 November 2007 18:49:24 Erik A. Dahl wrote:
> Eric,
>
> Can you take a look at this... I thought we fixed the problem.
>
> -EAD
And more fixes to min-max thresholds. Attached patches include all previous
fixes, and additionaly fix for displaying thresholds on graphs - if threshold
value vas > 1k and it was integer, displayed value was truncated. For
example, threshold of 1600 would be shown as 1.00k, which is wrong.
H.
>
> Begin forwarded message:
> > From: Hrvoje Habjanić <[EMAIL PROTECTED]>
> > Date: November 17, 2007 10:19:44 AM EST
> > To: General discussion of using zenoss system <zenoss-
> > [EMAIL PROTECTED]>
> > Subject: Re: [zenoss-users] Zenoss 2.1.1 threshold bug
> > Reply-To: General discussion of using zenoss system
> > <[email protected]
> >
> > On Saturday 17 November 2007 01:20:39 Allen Sanabria wrote:
> >> Happening to me as well. My scenerio, I removed the thresholds for
> >> load and
> >> it is still reporting :(
> >
> > Well, i did manage to solve my problem with attached patch. In short,
> > two "bugs" are fixed:
> > 1. even disabled thresholds wehe still evaluated
> > 2. type cast value for comparison with min/max values to float
> >
> > In any case, i'm not zenoss programer, so this patch can be
> > "dangerous", use
> > it on your own risk.
> >
> > And secondly, it seems that thresholds are somehow "cached". Even
> > deleting of
> > *.zec files, and restarting zenoss didn't clear them. Only after
> > zenperfsnmp
> > config period they seem to be somehow "updated" or owerwriten in
> > cache, so be
> > prepared to see errors in logs for some time. They should go away
> > later (at
> > least in my case).
> >
> > H.
> >
> > p.s. If anyone can foward this patch to dev list, i would be grateful.
> >
> >> On Friday 16 November 2007 05:40:43 pm Hrvoje Habjanić wrote:
> >>> Hi!
> >>>
> >>> Im running 2.1.1, around 100 devices. Some of them have disabled
> >>> thresholds. That is, the thresholds should be disabled (they are
> >>> disabled
> >>> on web), BUT it seems that zenoss is ignoring "enabled" property,
> >>> and
> >>> reporting alerts for them?!?
> >>> Can someone confirm this?
> >>>
> >>> I did migrate from 2.0.6 -> 2.1.0 -> 2.1.1, and i don't expect
> >>> that this
> >>> is the problem.
> >>>
> >>> H.
> >>> _______________________________________________
> >>> zenoss-users mailing list
> >>> [email protected]
> >>> http://lists.zenoss.org/mailman/listinfo/zenoss-users
> >>
> >> _______________________________________________
> >> zenoss-users mailing list
> >> [email protected]
> >> http://lists.zenoss.org/mailman/listinfo/zenoss-users
--- zenoss/Products/ZenModel/MinMaxThreshold.py.orig 2007-11-16 22:16:18.000000000 +0100
+++ zenoss/Products/ZenModel/MinMaxThreshold.py 2007-11-20 10:34:07.000000000 +0100
@@ -84,7 +84,8 @@
maxval=self.getMaxval(context),
eventClass=self.eventClass,
severity=self.severity,
- escalateCount=self.escalateCount)
+ escalateCount=self.escalateCount,
+ enabled=self.enabled)
return mmt
def getMinval(self, context):
@@ -110,7 +111,7 @@
class MinMaxThresholdInstance(ThresholdInstance):
def __init__(self, id, context, dpNames,
- minval, maxval, eventClass, severity, escalateCount):
+ minval, maxval, eventClass, severity, escalateCount, enabled):
self._context = context
self.id = id
self.minimum = minval
@@ -119,6 +120,7 @@
self.severity = severity
self.escalateCount = escalateCount
self.dataPointNames = dpNames
+ self.enabled = enabled
self._rrdInfoCache = {}
def name(self):
@@ -145,6 +147,8 @@
"""The given datapoints have been updated, so re-evaluate.
returns events or an empty sequence"""
result = []
+ if self.enabled == False:
+ return result
for dp in self.dataPointNames:
cycleTime, rrdType = self.rrdInfoCache(dp)
startStop, names, values = \
@@ -160,6 +164,8 @@
value to re-evalue the threshold."""
result = []
if value is None: return result
+ if self.enabled == False:
+ return result
try:
cycleTime, rrdType = self.rrdInfoCache(dataPoint)
except Exception:
@@ -181,10 +187,10 @@
if value is None:
return []
thresh = None
- if self.maximum is not None and value > self.maximum:
+ if self.maximum is not None and float(value) > self.maximum:
thresh = self.maximum
how = 'exceeded'
- if self.minimum is not None and value < self.minimum:
+ if self.minimum is not None and float(value) < self.minimum:
thresh = self.minimum
how = 'not met'
label = self.context().componentName or ''
@@ -203,7 +209,7 @@
else:
if self.count != 0 and self.count is not None:
summary = '%s %s threshold restored current value: %.2f' % (
- self.context().deviceName, label, value)
+ self.context().deviceName, label, float(value))
self.count = 0
return [dict(device=self.context().deviceName,
summary=summary,
@@ -255,6 +261,7 @@
def setPower(self, number):
powers = ("k", "M", "G")
if number < 1000: return number
+ number = float(number)
for power in powers:
number = number / 1000
if number < 1000:
--- zenoss/Products/ZenModel/RRDThreshold.py.orig 2007-11-20 10:35:14.000000000 +0100
+++ zenoss/Products/ZenModel/RRDThreshold.py 2007-11-20 10:37:17.000000000 +0100
@@ -160,6 +160,7 @@
def setPower(self, number):
powers = ("k", "M", "G")
if number < 1000: return number
+ number = float(number)
for power in powers:
number = number / 1000
if number < 1000:
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users