Archived community.zenoss.org | full text search
Skip navigation
8301 Views 4 Replies Latest reply: Mar 19, 2010 6:30 PM by mwcotton RSS
linuxdynasty ZenossMaster 156 posts since
Apr 10, 2007
Currently Being Moderated

Mar 19, 2010 4:00 PM

Here is another script I wrote to help you find Alerting Rules

Good Afternoon my fellow Zenoss users. here I bring you another Python tool to use with Zenoss. This tool will allow you to list all of your alerting rules, either by Group, User, or Query. If you are like me and have over 100 Alerting Rules. Managing these rules are more then a pain in the butt. Especially when you create a new rule and you know you created it correctly, but it just does not work... Well you might have another conflicting rule. Well what do you do in this situation?? You can go through each rule manually and sooner or later you will find it.

 

You can get it here..

http://www.linuxdynasty.org/how-to-find-alerting-rules-using-the-zenoss-api.html

 

Here are some examples...

 

[zenoss@zenoss ~]$ python ZalertingRules_Manager.py --type="users" --search="asanabria"
################################################################################
Alerting Rules for asanabria
************************************************************
Alerting Rule:        foo
SQL Query:    severity >= 4 and eventState = 0 and prodState = 1000

Windows for Alerting Rule foo
Window:      yee
Start time:  Thu Mar 18 14:40:30 2010
Duration:    days 0 hours 1 minutes 0
************************************************************

[zenoss@zenoss ~]$ python ZalertingRules_Manager.py --type="groups" --search="Escalation 0"
################################################################################
Alerting Rules for Escalation 0
************************************************************
Alerting Rule:        Server - QA
SQL Query:    (prodState = 1000) and (deviceClass like '/Server/Linux/QA Servers%') and (eventState = 0) and (severity >= 4)

************************************************************
Alerting Rule:        Email - Downgrade
SQL Query:    (prodState = 1000) and (eventClass like '/App/Email/Downgrade%') and (eventState = 0) and (severity >= 4)

************************************************************
Alerting Rule:        Email - Job Alerts
SQL Query:    (prodState = 1000) and (eventClass like '/App/Email/Job Alerts%') and (eventState = 0) and (severity >= 4)

Windows for Alerting Rule Email - Job Alerts
Window:      0700-0701
Start time:  Sat Mar 13 07:00:00 2010
Duration:    days 0 hours 0 minutes 1
***********************************************************

[zenoss@zenoss ~]$ python ZalertingRules_Manager.py --type="query" --search="/App/Log/Java"
################################################################################
Owner = App - Tomcat
Alerting Rule Tomcat Java Log
Matching Query = (prodState = 1000) and (eventClassKey not like '%Java Self Axis Scorer Infinite Loop%') and (eventState = 0) and (severity >= 3) and (eventClass like '/App/Log/Java/US/')
Window:      0100-2355
Start time:  Thu Mar 18 01:00:00 2010
Duration:    days 0 hours 22 minutes 55
************************************************************




################################################################################
Owner = Java Self Axis Scorer Infinite Loop
Alerting Rule Java Self Axis Scorer Infinite Loop
Matching Query = (prodState = 1000) and (eventClassKey like '%Java Self Axis Scorer Infinite Loop%') and (deviceClass like '/Server/Linux/Tomcat/%') and (eventClass like '/App/Log/Java/%') and (eventState = 0) and (severity >= 3)

More Like This

  • Retrieving data ...