def _do_autofix(self, event, autofix_script, log_id): trigger_name = event["trigger_name"] hostname = event["hostname"] executor = self.executor(hostname=hostname, user=options.executor_user) autofix_method = get_autofix_scripts().get(autofix_script).get( "fix_method") # do autofix, if it fix failed, it should raise an exception and # upper level codes will catch it then record it into database. autofix_method(trigger_name, hostname, executor, event)
def _do_autofix(self, event, autofix_script, log_id): trigger_name = event["trigger_name"] hostname = event["hostname"] executor = self.executor(hostname=hostname, user=options.executor_user) autofix_method = get_autofix_scripts().get(autofix_script).get( "fix_method" ) # do autofix, if it fix failed, it should raise an exception and # upper level codes will catch it then record it into database. autofix_method(trigger_name, hostname, executor, event)
def get(self): def convert_list_to_dict(ls): d = dict() for l in ls: name = l["trigger_name"] d[name] = l return d scripts = get_autofix_scripts().keys() triggers = self.zabbix.get_triggers_info(db=self.db).keys() bindings = convert_list_to_dict(self.db.get_autofix_bindings()) self.render("autofixbinding.html", scripts=scripts, triggers=triggers, bindings=bindings)
def get(self): def convert_list_to_dict(ls): d = dict() for l in ls: name = l["trigger_name"] d[name] = l return d scripts = get_autofix_scripts().keys() triggers = self.zabbix.get_triggers_info(db=self.db).keys() bindings = convert_list_to_dict( self.db.get_autofix_bindings() ) self.render("autofixbinding.html", scripts=scripts, triggers=triggers, bindings=bindings)
def get(self): scripts = get_autofix_scripts() self.render("autofixscriptslist.html", scripts=scripts)