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
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'))
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'))
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'))
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
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
def initialize(): global sender, admin_email, admin_sms, smtp_password logger.info('In initialize') mongohelper.initialize(config) logger.info('Mongo initialized')
def initialize(): logger.info('In initialize') mongohelper.initialize(config) logger.info('Mongo initialized')