Skip to content
Browse files

Merge branch 'master' of github.com:marineam/nagcat

  • Loading branch information...
2 parents f2ae8fe + 120da2d commit cb4a98b1319cc79f7d78549e3162f3a185735dbb Mike Cooper committed Aug 17, 2011
Showing with 24 additions and 8 deletions.
  1. +6 −0 python/nagcat/notify.py
  2. +18 −8 python/nagcat/plugins/notify_smtp.py
View
6 python/nagcat/notify.py
@@ -246,6 +246,12 @@ def __init__(self, type_, macros, config):
(self.macros['HOSTNAME'],
self.macros['SERVICEDESC'], ex))
+ def metadata(self, key, default=None):
+ macro = key.upper()
+ return self.macros.get('_CONTACT%s' % macro,
+ self.macros.get('_SERVICE%s' % macro,
+ self.macros.get('_HOST%s' % macro, default)))
+
def subject(self):
return self._format(self.config[self.type]['subject'])
View
26 python/nagcat/plugins/notify_smtp.py
@@ -100,14 +100,21 @@ def headers(self):
def body(self):
text = super(EmailNotification, self).body()
- if self.format == "long":
- urls = self.urls()
- if urls:
- text += "\n"
- if 'nagios' in urls:
- text += "Nagios: %s\n" % urls['nagios']
- if 'graphs' in urls:
- text += "Graphs: %s\n" % urls['graphs']
+ text += self.footer()
+ return text
+
+ def footer(self):
+ urls = self.urls()
+
+ if urls:
+ text = "\n"
+ if 'nagios' in urls:
+ text += "Nagios: %s\n" % urls['nagios']
+ if 'graphs' in urls:
+ text += "Graphs: %s\n" % urls['graphs']
+ else:
+ text = ""
+
return text
def send(self):
@@ -169,6 +176,9 @@ def headers(self):
headers['To'] = self.macros['CONTACTPAGER']
return headers
+ def footer(self):
+ return ""
+
def graph(self):
return None

0 comments on commit cb4a98b

Please sign in to comment.
Something went wrong with that request. Please try again.