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-16 22:06:16.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,
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to