Hrvoje Tolic [http://community.zenoss.org/people/htolic] created the discussion
"Re: Device Issues dashboard portlet remains empty"
To view the discussion, visit: http://community.zenoss.org/message/74967#74967
--------------------------------------------------------------
I opened a bug ticket on jira here http://jira.zenoss.com/jira/browse/ZEN-8721 http://jira.zenoss.com/jira/browse/ZEN-8721
I also enclosed my fix to the bug. It is working for me. I hope it doesn't break any other things. In the fix I use helper python list devprocessed which might not be the most efficient way to do it. The fix roams through events and there are usually multiple events per device and using this list I keep track of devices that I already processed so duplicates don't show up on Device Issues portlet.
diff --git a/Products/ZenWidgets/browser/Portlets.py b/Products/ZenWidgets/browser/Portlets.py
index de28299..beb3fed 100644
--- a/Products/ZenWidgets/browser/Portlets.py
+++ b/Products/ZenWidgets/browser/Portlets.py
@@ -19,12 +19,15 @@ from Products.Zuul import getFacade
from Products.ZenEvents.HeartbeatUtils import getHeartbeatObjects
from zenoss.protocols.services import ServiceException
from zenoss.protocols.services.zep import ZepConnectionError
+from zenoss.protocols.jsonformat import from_dict
+from zenoss.protocols.protobufs.zep_pb2 import EventSummary
from Products.ZenUtils.guid.interfaces import IGUIDManager
from Products.ZenUtils.jsonutils import json
from Products.ZenUtils.Utils import nocache, formreq, extractPostContent
from Products.ZenWidgets import messaging
from Products.ZenModel.Device import Device
from Products.ZenModel.ZenossSecurity import *
+from Products.ZenEvents.events2.proxy import EventSummaryProxy
from Products.ZenEvents.browser.EventPillsAndSummaries import \
                                   getDashboardObjectsEventSummary, \
                                   ObjectsEventSummary,   \
        """return device info for bad device to dashboard"""
        zep = getFacade('zep')
+Â Â Â Â Â Â Â zep_filter = zep.createEventFilter(status=[0,1], severity=[3,4,5], details={'zenoss.device.production_state':1000})
        manager = IGUIDManager(self.context.dmd)
-Â Â Â Â Â Â Â deviceSeverities = zep.getDeviceIssuesDict()
        zem = self.context.dmd.ZenEventManager
        devdata = []
-Â Â Â Â Â Â Â Â Â Â Â dev = manager.getObject(uuid)
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (not zem.checkRemotePerm(ZEN_VIEW, dev)
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â or dev.productionState < zem.prodStateDashboardThresh
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â alink = dev.getPrettyLink()
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â severities = deviceSeverities[uuid]
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â severities = dict((zep.getSeverityName(sev).lower(), counts) for (sev, counts) in severities.iteritems())
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pill = getEventPillME(dev, severities=severities)
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â evts = [alink,pill]
-Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â devdata.append((evts, severities))
+Â Â Â Â Â Â Â devprocessed = []
+Â Â Â Â Â Â Â Â Â Â Â evt = EventSummaryProxy(from_dict(EventSummary, summary))
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â uuid = summary['occurrence'][0]['actor']['element_uuid']
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dev = manager.getObject(uuid)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (not zem.checkRemotePerm(ZEN_VIEW, dev)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â or dev.productionState < zem.prodStateDashboardThresh
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â alink = dev.getPrettyLink()
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â severities = zep.getEventSeveritiesByUuid(uuid)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â severities = dict((zep.getSeverityName(sev).lower(), counts) for (sev, counts) in severities.iteritems())
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pill = getEventPillME(dev, severities=severities)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â evts = [alink,pill]
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â devdata.append((evts, severities))
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â devprocessed.append(evt.device)
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue
        devdata.sort(key=lambda x:(x[1]['critical'], x[1]['error'], x[1]['warning']), reverse=True)
        return [x[0] for x in devdata[:100]]
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74967#74967]
Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]