コード例 #1
0
ファイル: web.py プロジェクト: camerongray1515/Prophasis
def alerts_edit(alert_id):
    hosts = Host.query.all()
    host_groups = HostGroup.query.all()
    services = Service.query.all()
    checks = Check.query.all()
    plugins = Plugin.query.all()
    alert = Alert.query.get(alert_id)
    module_options_list = AlertModuleOption.query.filter(
        AlertModuleOption.alert_id==alert_id)
    alert_modules = get_alert_modules()

    module_options = {}
    for option in module_options_list:
        module_options[option.key] = option.value

    if not alert:
        abort(404)

    # Generate a list of tuples of state and it's human readable name ordered
    # by priority, highest first
    hp = Host.health_priorities
    states = []
    for state, priority in reversed(
        sorted(hp.items(), key=operator.itemgetter(1))):
        states.append((state, state.replace("_", " ").title()))

    return render_template("alert-form.html", nav_section="alerts",
        section="Alerts", title="Edit Alert", method="edit", hosts=hosts,
        host_groups=host_groups, services=services, checks=checks,
        states=states, plugins=plugins, alert=alert,
        module_options=module_options, alert_modules=alert_modules)
コード例 #2
0
ファイル: web.py プロジェクト: Seronsecurity/Honours-Project
def alerts_edit(alert_id):
    hosts = Host.query.all()
    host_groups = HostGroup.query.all()
    services = Service.query.all()
    checks = Check.query.all()
    plugins = Plugin.query.all()
    alert = Alert.query.get(alert_id)
    module_options_list = AlertModuleOption.query.filter(
        AlertModuleOption.alert_id==alert_id)
    alert_modules = get_alert_modules()

    module_options = {}
    for option in module_options_list:
        module_options[option.key] = option.value

    if not alert:
        abort(404)

    # Generate a list of tuples of state and it's human readable name ordered
    # by priority, highest first
    hp = Host.health_priorities
    states = []
    for state, priority in reversed(
        sorted(hp.items(), key=operator.itemgetter(1))):
        states.append((state, state.replace("_", " ").title()))

    return render_template("alert-form.html", nav_section="alerts",
        section="Alerts", title="Add Alert", method="edit", hosts=hosts,
        host_groups=host_groups, services=services, checks=checks,
        states=states, plugins=plugins, alert=alert,
        module_options=module_options, alert_modules=alert_modules)
コード例 #3
0
ファイル: web.py プロジェクト: Seronsecurity/Prophasis
def alerts_add():
    hosts = Host.query.all()
    host_groups = HostGroup.query.all()
    services = Service.query.all()
    checks = Check.query.all()
    plugins = Plugin.query.all()

    alert_modules = get_alert_modules()

    # Generate a list of tuples of state and it's human readable name ordered
    # by priority, highest first
    hp = Host.health_priorities
    states = []
    for state, priority in reversed(
            sorted(hp.items(), key=operator.itemgetter(1))):
        states.append((state, state.replace("_", " ").title()))

    return render_template("alert-form.html",
                           nav_section="alerts",
                           section="Alerts",
                           title="Add Alert",
                           method="add",
                           hosts=hosts,
                           host_groups=host_groups,
                           services=services,
                           checks=checks,
                           states=states,
                           plugins=plugins,
                           alert_modules=alert_modules)
コード例 #4
0
ファイル: web.py プロジェクト: camerongray1515/Prophasis
def alerts_add():
    hosts = Host.query.all()
    host_groups = HostGroup.query.all()
    services = Service.query.all()
    checks = Check.query.all()
    plugins = Plugin.query.all()

    alert_modules = get_alert_modules()

    # Generate a list of tuples of state and it's human readable name ordered
    # by priority, highest first
    hp = Host.health_priorities
    states = []
    for state, priority in reversed(
        sorted(hp.items(), key=operator.itemgetter(1))):
        states.append((state, state.replace("_", " ").title()))

    return render_template("alert-form.html", nav_section="alerts",
        section="Alerts", title="Add Alert", method="add", hosts=hosts,
        host_groups=host_groups, services=services, checks=checks,
        states=states, plugins=plugins, alert_modules=alert_modules)