Discussion:
Device Issues Portlet blank
Photon
2013-10-02 17:27:42 UTC
Permalink
Photon [http://community.zenoss.org/people/Photon] created the discussion

"Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/74819#74819

--------------------------------------------------------------
Hi every1,

  We've had an issue with the device issues portlet ever since we installed 4.2.4 and the SP71 patch. The porlet is now blank. We tried to follow its source code to see where it would lead us. In */opt/zenoss/Products/ZenWidgets/browser/Portlets.py,* we found these lines (inside getDeviceDashboard method which is called by getDeviceIssuesJSON) :
*zep = getFacade('zep')*
*...*
*deviceSeverities = zep.getDeviceIssuesDict()*

By using zendmd and executing these lines :
*from Products.Zuul import getFacade*
*zep = getFacade('zep')*
*deviceSeverities = zep.getDeviceIssuesDict()*
*deviceServerities.viewitems()*
we get an empty dict. On the other hand, using *zep.getEventSummariesGenerator()*, we can extract all current events.
The Root Organizer portlet isn't empty and extracts correctly events.

Any idea on why we're having this issue ?

Thanks in advance.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74819#74819]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Eric Gemme
2013-10-11 11:13:28 UTC
Permalink
Eric Gemme [http://community.zenoss.org/people/egemme] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/74931#74931

--------------------------------------------------------------
We too have this issue.   Device issues portlet worked prior SP71.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74931#74931]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Hrvoje Tolic
2013-10-16 06:47:16 UTC
Permalink
Hrvoje Tolic [http://community.zenoss.org/people/htolic] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/74968#74968

--------------------------------------------------------------
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.

Here's the code for the fix:

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,    \

@@ -183,27 +186,34 @@ class DeviceIssuesPortletView(BrowserView):
     def getDeviceDashboard(self):
         """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 = []
-        for uuid in deviceSeverities.keys():
-            dev = manager.getObject(uuid)
-            if dev and isinstance(dev, Device):
-                if (not zem.checkRemotePerm(ZEN_VIEW, dev)
-                    or dev.productionState < zem.prodStateDashboardThresh
-                    or dev.priority < zem.priorityDashboardThresh):
-                    continue
-                alink = dev.getPrettyLink()
-                try:
-                    severities = deviceSeverities[uuid]
-                    severities = dict((zep.getSeverityName(sev).lower(), counts) for (sev, counts) in severities.iteritems())
-                    pill = getEventPillME(dev, severities=severities)
-                except ServiceException:
-                    continue
-                evts = [alink,pill]
-                devdata.append((evts, severities))
+        devprocessed = []
+        for summary in zep.getEventSummariesGenerator(filter=zep_filter):
+            evt = EventSummaryProxy(from_dict(EventSummary, summary))
+            try:
+                uuid = summary['occurrence'][0]['actor']['element_uuid']
+                dev = manager.getObject(uuid)
+                if dev and isinstance(dev, Device) and evt.device not in devprocessed:
+                    if (not zem.checkRemotePerm(ZEN_VIEW, dev)
+                        or dev.productionState < zem.prodStateDashboardThresh
+                        or dev.priority < zem.priorityDashboardThresh):
+                        continue
+                    alink = dev.getPrettyLink()
+                    try:
+                        severities = zep.getEventSeveritiesByUuid(uuid)
+                        severities = dict((zep.getSeverityName(sev).lower(), counts) for (sev, counts) in severities.iteritems())
+                        pill = getEventPillME(dev, severities=severities)
+                    except ServiceException:
+                        continue
+                    evts = [alink,pill]
+                    devdata.append((evts, severities))
+                    devprocessed.append(evt.device)
+            except KeyError:
+                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/74968#74968]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Eric Gemme
2013-10-17 22:29:12 UTC
Permalink
Eric Gemme [http://community.zenoss.org/people/egemme] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/74979#74979

--------------------------------------------------------------
Hrvoje,  I can't see you Jira ticket.   Is it gone?   I wanted to see if someone picked it up for evaluation.

As I look at you fix,  I think someone must have broken some typical input for the issues portlet in SP71.   So prior to apply your fix,  I would like to know if the input in question is gone forever because it became deprecated,  or someone really goofed on this one and could be restored shortly.   In the latter case,  I will wait for a more permanent fix.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74979#74979]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Hrvoje Tolic
2013-10-18 07:25:12 UTC
Permalink
Hrvoje Tolic [http://community.zenoss.org/people/htolic] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/74996#74996

--------------------------------------------------------------
The security level on my bug reports says Internal so I guess you can't open it, sorry about that, still learning about Jira. I've been asked to reproduce it with the latest RPS build 154 but I think I won't have time to test it for some time. If anyone can test, I would love to hear the results so we can discard the bug and move on.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74996#74996]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Hrvoje Tolic
2013-10-25 08:05:41 UTC
Permalink
Hrvoje Tolic [http://community.zenoss.org/people/htolic] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/75068#75068

--------------------------------------------------------------
Ok, I've tested with RPS 154. The Portlet remains broken for me. Can others confirm?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/75068#75068]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Eric Gemme
2013-10-25 13:03:42 UTC
Permalink
Eric Gemme [http://community.zenoss.org/people/egemme] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/75087#75087

--------------------------------------------------------------
Hrvoje,  where do you get most current RPS ?    All I know of is on Zenup wiki page and the most current is SP71
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/75087#75087]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Hrvoje Tolic
2013-10-25 13:05:51 UTC
Permalink
Hrvoje Tolic [http://community.zenoss.org/people/htolic] created the discussion

"Re: Device Issues Portlet blank"

To view the discussion, visit: http://community.zenoss.org/message/75088#75088

--------------------------------------------------------------
It's only on sf for now:
http://sourceforge.net/projects/zenoss/files/zenoss-4.2/zenoss-4.2.4/updates/2013-10-15/zenoss_core-4.2.4-SP154.zup/download http://sourceforge.net/projects/zenoss/files/zenoss-4.2/zenoss-4.2.4/updates/2013-10-15/zenoss_core-4.2.4-SP154.zup/download
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/75088#75088]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...