示例#1
0
 def __init__(self, config):
     BackupNotification.__init__(self, config, "telegram")
     try:
         self.api_token = config.get("telegram", "api_token")
     except:
         self.api_token = config.get_or_envvar("defaults", "api_token", "TELEGRAM_API_TOKEN")
     try:
         self.chat_id = config.get("telegram", "chat_id")
     except:
         self.chat_id = config.get_or_envvar("defaults", "chat_id", "TELEGRAM_CHAT_ID")
示例#2
0
 def __init__(self, config):
     BackupNotification.__init__(self, config, 'smtp')
     try:
         self.host = config.get('smtp', 'host')
     except:
         self.host = config.get_or_envvar('defaults', 'host', 'SMTP_HOST')
     try:
         self.port = int(config.get('smtp', 'port'))
     except:
         self.port = int(config.get_or_envvar('defaults', 'port', 'SMTP_PORT'))
     try:
         self.username = config.get('smtp', 'username')
     except:
         self.username = config.get_or_envvar('defaults', 'username', 'SMTP_USERNAME')
     try:
         self.password = config.get('smtp', 'password')
     except:
         self.password = config.get_or_envvar('defaults', 'password', 'SMTP_PASSWORD')
     try:
         self.use_tls = int(config.get('smtp', 'use_tls')) == 1
     except:
         self.use_tls = int(config.get_or_envvar('defaults', 'use_tls', 'SMTP_USE_TLS')) == 1
     try:
         self.use_ssl = int(config.get('smtp', 'use_ssl')) == 1
     except:
         self.use_ssl = int(config.get_or_envvar('defaults', 'use_ssl', 'SMTP_USE_SSL')) == 1
     try:
         self.success_to = config.get('smtp', 'success_to')
     except:
         self.success_to = config.get_or_envvar('defaults', 'success_to', 'SMTP_SUCCESS_TO')
     try:
         self.failure_to = config.get('smtp', 'failure_to')
     except:
         self.failure_to = config.get_or_envvar('defaults', 'failure', 'SMTP_FAILURE_TO')
     try:
         self.debug = int(config.get('smtp', 'debug')) == 1
     except:
         try:
             self.debug = int(config.get_or_envvar('defaults', 'debug', 'SMTP_DEBUG')) == 1
         except:
             self.debug = False
示例#3
0
    def __init__(self, config):
        BackupNotification.__init__(self, config, 'prometheus')
        try:
            self.url = config.get('prometheus', 'url')
        except:
            self.url = config.get_or_envvar('defaults', 'url', 'PUSHGW_URL')
        try:
            self.username = config.get('prometheus', 'username')
        except:
            self.username = config.get_or_envvar('defaults', 'username', 'PUSHGW_USERNAME')
        try:
            self.password = config.get('prometheus', 'password')
        except:
            self.password = config.get_or_envvar('defaults', 'password', 'PUSHGW_PASSWORD')
        self.notify_on_success = True
        self.notify_on_failure = False

        auth_args = None
        if self.username is not None:
            self.auth_args = {
                'username': self.username,
                'password': self.password
            }
示例#4
0
 def __init__(self, config):
     BackupNotification.__init__(self, config, 'hipchat')
     try:
         self.url = config.get('hipchat', 'url')
     except:
         self.url = config.get_or_envvar('defaults', 'url', 'HIPCHAT_URL')
示例#5
0
 def __init__(self, config):
     BackupNotification.__init__(self, config, 'slack')
     try:
         self.url = config.get('slack', 'url')
     except:
         self.url = config.get_or_envvar('defaults', 'url', 'SLACK_URL')