Esempio n. 1
0
def action(request):
    auth = ZabbixRestAPI.get_auth("Admin", "zabbix")
    zabbix = ZabbixRestAPI(auth)
    result = zabbix.get_actions(filters={"eventsource": 0}, output="extend", selectOperations="extend", selectFilter="extend")
    if result.get("result"):
        actions = result.get("result")
    else:
        actions = result

    return render(request, "monitoring/action/index.html", {"actions": actions})
Esempio n. 2
0
def action_modal(request):
    modal_title = request.GET.get("modal_title")
    auth = ZabbixRestAPI.get_auth("Admin", "zabbix")
    zabbix = ZabbixRestAPI(auth)
    result = {"modal_title": modal_title}
    if request.GET.get("action_id"):
        action_id = request.GET.get("action_id")
        action_result = zabbix.get_actions(filters={"eventsource": 0}, output="extend", selectOperations="extend", selectFilter="extend", actionids=action_id)
        if action_result.get("result") and len(action_result.get("result")) > 0:
            result["action"] = action_result.get("result")[0]
        else:
            result["action"] = action_result
    return render(request, "monitoring/action/modal.html", result)