Hi!

I noticed that when you have defined more than one datapoints in one 
datasource, only last one (datapoint) will be updated. As i see it, it is bug 
because gui allows to add more than one datapoint. So i did wrote this patch 
which corrects this bug, and updates all datapoints within one datasource.

(i didn't check if there is already ticket for this ...)

The patch itself is preaty straight forward - instead of scalar reference to 
datapoint in datasource, i created dictionary (name is key) which holds all 
datapoints in datasource.

Again, i'm not zenoss programmer, so use this patch on your own.

H.

p.s. I someone could forward this to dev team ... :-)
--- zenoss/Products/ZenRRD/zenperfsnmp.py.orig	2007-11-29 21:26:32.000000000 +0100
+++ zenoss/Products/ZenRRD/zenperfsnmp.py	2007-11-30 14:10:41.000000000 +0100
@@ -431,7 +431,14 @@
             # beware empty oids
             if oid:
                 oid = '.' + oid
-                p.oidMap[oid] = d = oidMap.setdefault(oid, OidData())
+                if oidMap.has_key(oid) and oidMap[oid].has_key(name):
+                    d = oidMap[oid][name]
+		else:
+                    d = OidData()
+                if p.oidMap.has_key(oid):
+                    p.oidMap[oid][name] = d
+                else:
+                    p.oidMap[oid] = { name: d }
                 d.update(name, path, dsType, createCmd, minmax)
         self.proxies[deviceName] = p
         self.thresholds.updateList(thresholds)
@@ -529,16 +536,16 @@
         proxy = self.proxies.get(deviceName, None)
         if proxy is None:
             return
-        name = proxy.oidMap[oid].name
-        summary = 'Error reading value for "%s" on %s (oid %s is bad)' % (
-            name, deviceName, oid)
-        self.sendEvent(proxy.snmpStatus.snmpStatusEvent,
-                       eventClass=Perf_Snmp,
-                       device=deviceName,
-                       summary=summary,
-                       component=name,
-                       severity=Event.Info)
-        self.log.warn(summary)
+        for name in proxy.oidMap[oid].keys():
+            summary = 'Error reading value for "%s" on %s (oid %s is bad)' % (
+                name, deviceName, oid)
+            self.sendEvent(proxy.snmpStatus.snmpStatusEvent,
+                           eventClass=Perf_Snmp,
+                           device=deviceName,
+                           summary=summary,
+                           component=name,
+                           severity=Event.Info)
+            self.log.warn(summary)
         del proxy.oidMap[oid]
         
 
@@ -600,19 +607,20 @@
 
     def storeRRD(self, device, oid, value):
         'store a value into an RRD file'
-        oidData = self.proxies[device].oidMap.get(oid, None)
-        if not oidData: return
+        oidDataArr = self.proxies[device].oidMap.get(oid, None)
+        if not oidDataArr: return
 
-        min, max = oidData.minmax
-        value = self.rrd.save(oidData.path,
-                              value,
-                              oidData.dataStorageType,
-                              oidData.rrdCreateCommand,
-                              min=min, max=max)
-
-        for ev in self.thresholds.check(oidData.path, time.time(), value):
-            ev['eventKey'] = oid
-            self.sendThresholdEvent(**ev)
+        for oidData in oidDataArr.values():
+            min, max = oidData.minmax
+            saveval = self.rrd.save(oidData.path,
+                                  value,
+                                  oidData.dataStorageType,
+                                  oidData.rrdCreateCommand,
+                                  min=min, max=max)
+
+            for ev in self.thresholds.check(oidData.path, time.time(), saveval):
+                ev['eventKey'] = oid
+                self.sendThresholdEvent(**ev)
 
     def connected(self):
         "Run forever, fetching and storing"
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to