def __init__(self, config_options): Alerter.__init__(self, config_options) try: mail_host = config_options["host"] from_addr = config_options["from"] to_addr = config_options["to"] except: raise RuntimeError("Required configuration fields missing") if mail_host == "": raise RuntimeError("missing mailserver hostname") if from_addr == "": raise RuntimeError("missing mail from address") if to_addr == "": raise RuntimeError("missing mail to address") if config_options.has_key("port"): try: mail_port = int(config_options["port"]) except: raise RuntimeError("mail port is not an integer") else: mail_port = 25 self.mail_host = mail_host self.mail_port = mail_port self.from_addr = from_addr self.to_addr = to_addr self.support_catchup = True
def __init__(self, config_options): if not boto3_available: print "Boto3 package is not available, cannot use SESAlerter." return Alerter.__init__(self, config_options) try: from_addr = config_options["from"] to_addr = config_options["to"] except: raise RuntimeError("Required configuration fields missing") if from_addr == "": raise RuntimeError("missing mail from address") if to_addr == "": raise RuntimeError("missing mail to address") self.from_addr = from_addr self.to_addr = to_addr self.support_catchup = True self.ses_client_params = {} if 'aws_region' in config_options: os.environ["AWS_DEFAULT_REGION"] = config_options['aws_region'] if 'aws_access_key' in config_options and 'aws_secret_key' in config_options: self.ses_client_params['aws_access_key_id'] = config_options['aws_access_key'] self.ses_client_params['aws_secret_access_key'] = config_options['aws_secret_key']
def __init__(self, config_options): if not boto3_available: print "Boto3 package is not available, cannot use SESAlerter." return Alerter.__init__(self, config_options) try: from_addr = config_options["from"] to_addr = config_options["to"] except: raise RuntimeError("Required configuration fields missing") if from_addr == "": raise RuntimeError("missing mail from address") if to_addr == "": raise RuntimeError("missing mail to address") self.from_addr = from_addr self.to_addr = to_addr self.support_catchup = True self.ses_client_params = {} if 'aws_region' in config_options: os.environ["AWS_DEFAULT_REGION"] = config_options['aws_region'] if 'aws_access_key' in config_options and 'aws_secret_key' in config_options: self.ses_client_params['aws_access_key_id'] = config_options[ 'aws_access_key'] self.ses_client_params['aws_secret_access_key'] = config_options[ 'aws_secret_key']
def __init__(self, config_options): Alerter.__init__(self, config_options) try: username = config_options["username"] password = config_options["password"] target = config_options["target"] except: raise RuntimeError("Required configuration fields missing") if 'sender' in config_options: sender = config_options["sender"] if len(sender) > 11: print "warning: truncating SMS sender name to 11 chars" sender = sender[:11] else: sender = "SmplMntr" api_host = 'www.bulksms.co.uk' if 'api_host' in config_options: api_host = config_options['api_host'] self.username = username self.password = password self.target = target self.sender = sender self.api_host = api_host self.support_catchup = True
def __init__(self, config_options): if not requests_available: print "Requests package is not available, cannot use SlackAlerter." print "Try: pip install -r requirements.txt" return Alerter.__init__(self, config_options) try: url = config_options['url'] except: raise RuntimeError("Required configuration fields missing") if 'channel' in config_options: channel = config_options['channel'] else: channel = None if 'username' in config_options: username = config_options['username'] else: username = None if url == "": raise RuntimeError("missing url") self.url = url self.channel = channel self.username = username
def __init__(self, config_options): if not requests_available: print "Requests package is not available, cannot use SlackAlerter." return Alerter.__init__(self, config_options) try: appid = config_options['appid'] secret = config_options['secret'] template = config_options['template'] users = config_options['users'] redis = config_options['redis'] except: raise RuntimeError("Required configuration fields missing") if appid == "": raise RuntimeError("missing wechat appid") if secret == "": raise RuntimeError("missing wechat secret") if template == "": raise RuntimeError("missing wechat secret") if users == "": raise RuntimeError("missing users secret") self.appid = appid self.secret = secret self.template = template self.users = users self.redis = redis
def __init__(self, config_options): Alerter.__init__(self, config_options) try: pushbullet_token = config_options["token"] except: raise RuntimeError("Required configuration fields missing") if pushbullet_token == "": raise RuntimeError("missing pushbullet token") self.pushbullet_token = pushbullet_token self.support_catchup = True
def __init__(self, config_options): Alerter.__init__(self, config_options) try: pushover_token = config_options["token"] pushover_user = config_options["user"] except: raise RuntimeError("Required configuration fields missing") if pushover_token == "": raise RuntimeError("missing pushover token") if pushover_user == "": raise RuntimeError("missing pushover user") self.pushover_token = pushover_token self.pushover_user = pushover_user self.support_catchup = True
def __init__(self, config_options): Alerter.__init__(self, config_options) try: mail_host = config_options["host"] from_addr = config_options["from"] to_addr = config_options["to"] except: raise RuntimeError("Required configuration fields missing") if mail_host == "": raise RuntimeError("missing mailserver hostname") if from_addr == "": raise RuntimeError("missing mail from address") if to_addr == "": raise RuntimeError("missing mail to address") if 'port' in config_options: try: mail_port = int(config_options["port"]) except: raise RuntimeError("mail port is not an integer") else: mail_port = 25 self.username = None self.password = None if 'username' in config_options: self.username = config_options['username'] if 'password' in config_options: self.password = config_options['password'] if 'ssl' in config_options: if config_options['ssl'] == 'starttls': self.ssl = 'starttls' elif config_options['ssl'] == 'yes': print 'Warning: ssl=yes for email alerter is untested' self.ssl = 'yes' else: self.ssl = None self.mail_host = mail_host self.mail_port = mail_port self.from_addr = from_addr self.to_addr = to_addr self.support_catchup = True
def __init__(self, config_options): Alerter.__init__(self, config_options) # config options # fail command string # recover command string if 'fail_command' in config_options: self.fail_command = config_options['fail_command'] else: self.fail_command = None if 'success_command' in config_options: self.success_command = config_options['success_command'] else: self.success_command = None if 'catchup_command' in config_options: self.catchup_command = config_options['catchup_command']
def __init__(self, config_options): if not requests_available: print "Requests package is not available, cannot use SlackAlerter." return Alerter.__init__(self, config_options) try: url = config_options['url'] except: raise RuntimeError("Required configuration fields missing") if 'channel' in config_options: channel = config_options['channel'] else: channel = None if url == "": raise RuntimeError("missing url") self.url = url self.channel = channel
def __init__(self, config_options): Alerter.__init__(self, config_options) try: apikey = config_options["apikey"] except: raise RuntimeError("Required configuration fields missing") api_host = 'www.notifymyandroid.com' if 'api_host' in config_options: api_host = config_options['api_host'] application = 'SimpleMonitor' if 'application' in config_options: application = config_options['application'] self.apikey = apikey self.api_host = api_host self.application = application self.support_catchup = True
def __init__(self, config_options): if not requests_available: print "Requests package is not available, cannot use FortySixElksAlerter." print "Try: pip install -r requirements.txt" return Alerter.__init__(self, config_options) try: username = config_options["username"] password = config_options["password"] target = config_options["target"] except: raise RuntimeError("Required configuration fields missing") if 'sender' in config_options: sender = config_options["sender"] if sender[0] == '+' and sender[1:].isdigit(): # sender is phone number pass elif len(sender) < 3: raise RuntimeError( "SMS sender name must be at least 3 chars long") elif len(sender) > 11: print "warning: truncating SMS sender name to 11 chars" sender = sender[:11] else: sender = "SmplMntr" api_host = 'api.46elks.com' if 'api_host' in config_options: api_host = config_options['api_host'] self.username = username self.password = password self.target = target self.sender = sender self.api_host = api_host self.support_catchup = True
def __init__(self, config_options): if not requests_available: print "Requests package is not available, cannot use FortySixElksAlerter." print "Try: pip install -r requirements.txt" return Alerter.__init__(self, config_options) try: username = config_options["username"] password = config_options["password"] target = config_options["target"] except: raise RuntimeError("Required configuration fields missing") if 'sender' in config_options: sender = config_options["sender"] if sender[0] == '+' and sender[1:].isdigit(): # sender is phone number pass elif len(sender) < 3: raise RuntimeError("SMS sender name must be at least 3 chars long") elif len(sender) > 11: print "warning: truncating SMS sender name to 11 chars" sender = sender[:11] else: sender = "SmplMntr" api_host = 'api.46elks.com' if 'api_host' in config_options: api_host = config_options['api_host'] self.username = username self.password = password self.target = target self.sender = sender self.api_host = api_host self.support_catchup = True
def __init__(self, config_options): Alerter.__init__(self, config_options) try: username = config_options["username"] password = config_options["password"] target = config_options["target"] except: raise RuntimeError("Required configuration fields missing") if config_options.has_key("sender"): sender = config_options["sender"] if len(sender) > 11: print "warning: truncating SMS sender name to 11 chars" sender = sender[:11] else: sender = "SmplMntr" self.username = username self.password = password self.target = target self.sender = urllib.quote(sender) self.support_catchup = True