Tuesday 6 December 2011

Zenoss: filtering the icons on the Infrastructure tree

This is the next article about my small hacks of Zenoss.

This time I will show how I filter the events which are taken for represent event severities with the appropriate Device Class, Group, System and Location at the Infrastructure->Devices page . The main reason for this, is that I have added in zenoss all systems from ours "Server" networks. These servers could be in "Test", "Pre-production", "Maintenance" and even "Decommissioned" state. Thus, there is number of events we could ignore. Moreover, on the "Production" systems we could have some events which we already aware of. If not filter these events, the icons on the Infrastructure tree element does not show us the real state of our infrastructure, and we have almost all tree filled with Warning, Error or Critical icons.

Unfortunately, because of poor knowledge of Python, the filter is hardcoded. Nevertheless - it works :)

[zenoss@zenoss infos]$ pwd
/opt/zenoss/Products/Zuul/infos
[zenoss@zenoss infos]$  diff ./device.py.orig ./device.py -u
--- ./device.py.orig    2011-12-06 19:08:19.000000000 +0000
+++ ./device.py 2011-12-06 18:59:06.000000000 +0000
@@ -100,7 +100,10 @@
         f = getFacade('event')
         root = self.root.uid.split('/')[3]
         orgcol = ORGTYPES[root]
-        q = 'select %s, max(severity) from status group by %s' % (orgcol,
+       """
+       Added "where eventState = '0'" to suppress error icon in tree on acknowledged events
+       """
+        q = "select %s, max(severity) from status where eventState = '0' and prodState > '499' group by %s" % (orgcol,
                                                                   orgcol)
         result = {}
         for org, sev in f._run_query(q, ()):
You can see my tree with- (left) and without (right) the filter applied. (Yep, there are event some critical events in Production. Will solve them tomorrow... if lucky... )

 

Hope this will help.
Stay tuned :)

No comments:

Post a Comment