Exemplo n.º 1
0
def main(input_config):
    global config, sms_numbers
    try:
        logger.info('Started %s monitor' % (module))
        config = input_config
        initialize()
        error_count = 0
        sms_numbers = mongohelper.get_oncall_sms_nos(config)
        logger.debug(sms_numbers)
        while error_count <= config.email_max_errors:
            try:
                issue = mongohelper.get_new_issue(config)
                if issue != None:
                    logger.debug('Got issue %s' % (issue.__str__()))
                    sms_issue(config, issue)
                else:
                    logger.info('No issues to notify')
                    break
            except pymongo.errors.AutoReconnect as pmar:
                logger.error(pmar)
                error_count += 1
                mongohelper.initialize(config)
            except mongohelper.CannotConnectToMongo as cctm:
                logger.critical('Cannot connect to Mongo %s' % (cctm))
                raise
            except:
                logger.error(traceback.format_exc())
                error_count += 1

    except:
        error = traceback.format_exc()
        logger.critical(error)
        mailhelpers.alert_admin(config, module, error)
        raise
Exemplo n.º 2
0
def main():
    logger.info('%s started' % (module))
    config = confighelper.get_config()
    logger.info('Obtained config')
    logger.debug(config.__dict__)
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    mongohelper.seed_users(config, get_users_from_file('userlist.txt'))
Exemplo n.º 3
0
def main():
    logger.info('%s started' % (module))
    config = confighelper.get_config()
    logger.info('Obtained config')
    logger.debug(config.__dict__)
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    mongohelper.seed_users(config, get_users_from_file('userlist.txt'))
Exemplo n.º 4
0
def main():
    logger.info('%s started' % (module))
    config = confighelper.get_config()
    logger.info('Obtained config')
    logger.debug(config.__dict__)
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    mongohelper.upsert_schedules(config, get_schedules_from_files('groups.txt','schedules.txt'))
Exemplo n.º 5
0
def main():
    logger.info('%s started' % (module))
    config = confighelper.get_config()
    logger.info('Obtained config')
    logger.debug(config.__dict__)
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    mongohelper.upsert_schedules(
        config, get_schedules_from_files('groups.txt', 'schedules.txt'))
Exemplo n.º 6
0
def initialize():
    global sender, admin_email, admin_sms, smtp_password
    logger.info('In initialize')
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    proxy, auth = jirahelpers.auth_against_jira(config.jirauri,
                                                config.jirauser,
                                                config.jirapassword,
                                                config.jira_max_errors)
    logger.info('Authenticated against JIRA')
    return proxy, auth
Exemplo n.º 7
0
def initialize():
    global sender, admin_email, admin_sms, smtp_password
    logger.info('In initialize')
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
    proxy, auth = jirahelpers.auth_against_jira(config.jirauri, 
                                                config.jirauser, 
                                                config.jirapassword, 
                                                config.jira_max_errors)
    logger.info('Authenticated against JIRA')
    return proxy, auth
Exemplo n.º 8
0
def main(input_config):
    global config, sms_numbers
    try:
        logger.info('Started %s monitor' % (module))
        config = input_config
        initialize()
        error_count = 0
        sms_numbers= mongohelper.get_oncall_sms_nos(config)
        logger.debug(sms_numbers)
        while error_count <= config.email_max_errors:
            try:
                issue = mongohelper.get_new_issue(config)
                if issue != None:
                    logger.debug('Got issue %s' % (issue.__str__()))
                    sms_issue(config, issue)
                else:
                    logger.info('No issues to notify')
                    break
            except pymongo.errors.AutoReconnect as pmar:
                logger.error(pmar)
                error_count += 1
                mongohelper.initialize(config)
            except mongohelper.CannotConnectToMongo as cctm:
                logger.critical('Cannot connect to Mongo %s' % (cctm))
                raise
            except:
                logger.error(traceback.format_exc())
                error_count += 1
        
    except:
        error = traceback.format_exc()
        logger.critical(error)
        mailhelpers.alert_admin(config, 
                                module, 
                                error)
        raise
Exemplo n.º 9
0
def initialize():
    global sender, admin_email, admin_sms, smtp_password
    logger.info('In initialize')
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
Exemplo n.º 10
0
def initialize():
    global sender, admin_email, admin_sms, smtp_password
    logger.info('In initialize')
    mongohelper.initialize(config)
    logger.info('Mongo initialized')
Exemplo n.º 11
0
def initialize():
    logger.info('In initialize')
    mongohelper.initialize(config)
    logger.info('Mongo initialized')