Skip to content

Instantly share code, notes, and snippets.

@dpetzel
Created February 22, 2012 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpetzel/1885932 to your computer and use it in GitHub Desktop.
Save dpetzel/1885932 to your computer and use it in GitHub Desktop.
import re
# Lets try and reduce noise here. Since services have multiple
# JMX data sources, we really don't need multiple events for each data source
# A single event should do the trick. We are going to normalize the summary
# so that dedupe rules kick in
re_string = "^DataSource\s(?P<app_name>.*?)\s.*?;\serror connecting to server"
if getattr(evt, "summary", "") != "":
m = re.search(re_string, evt.summary)
if m and m.group('app_name'):
new_summary = "".join([m.group('app_name'), " - ",
"Unable to establish JMX Connection"
])
evt.summary = new_summary
#Additionally The eventKey, which is part of thed de-dupe hash
# contains the data point. Lets crush that as well for a better
# hit rate
evt.eventKey = m.group('app_name')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment