Created
October 25, 2017 20:44
-
-
Save Ziaunys/d7be5c95139a767b475b02d4d2cc3cd5 to your computer and use it in GitHub Desktop.
Icinga Notifier Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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