Skip to content

Instantly share code, notes, and snippets.

@Ziaunys
Created October 25, 2017 20:44
Show Gist options
  • Save Ziaunys/d7be5c95139a767b475b02d4d2cc3cd5 to your computer and use it in GitHub Desktop.
Save Ziaunys/d7be5c95139a767b475b02d4d2cc3cd5 to your computer and use it in GitHub Desktop.
Icinga Notifier Code
#!/usr/bin/python
import datetime
import os
import re
class Notifier(object):
def _get_icinga_macros(self):
env_keys = os.environ.keys()
icinga_keys = [ m.group(0)
for m in [ re.search('^ICINGA_.*$', k)
for k in env_keys ]
if m ]
event_data = { s.replace("ICINGA_", "").lower():
os.environ[s] for s in icinga_keys }
return event_data
@property
def event(self):
macros = self._get_icinga_macros()
return macros
def notify(self):
raise NotImplementedError()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment