zabbix-super-vision/templates/index.html
sylvain.chateau f2235d4b45 New supervision
- using fastAPI
- offline/online working
- warning if ZABBIX API is too long
- showing settings
- showing last ack message
- showing procedure
- menu split by SU team
2024-02-05 15:47:38 +01:00

242 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>[{{total_alerts}}] Super(Vision)</title>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/octicons.min.css">
<link rel="stylesheet" href="/css/default.css">
<link rel="stylesheet" href="/css/font-awesome-4.7.0/css/font-awesome.min.css">
<script type="text/javascript" src="/js/jquery-3.4.1.slim.min.js"></script>
<script type="text/javascript" src="/js/dynafav-1.0.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
</head>
<body>
<div class="modal fade" id="configModal" tabindex="-1" role="dialog" aria-labelledby="configModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="configModalLabel">Configuration</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
SET on settings.py
<div class="list-group mb-4">
{% for key, value in config.items() %}
<a href="#" class="list-group-item list-group-item-action">
{{ key }}: {{ value }}
</a>
{% endfor %}
</div>
Hard value
<div class="list-group mb-4">
<a href="#" class="list-group-item list-group-item-action">
REFRESH SUPER: 30
</a>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="/">[{{total_alerts}}] Super(Vision)</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse navbar-sm" id="navbarSupportedContent">
<ul class="navbar-nav">
{% for team, hostgroups in teams.items() %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ team }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% for hostgroup in hostgroups %}
<a class="dropdown-item" href='/{{hostgroup}}'>{{ hostgroup }}</a>
{% endfor %}
</div>
</li>
{% endfor %}
</ul>
<div class="ml-auto">
<button class="btn btn-outline-secondary" type="button" data-toggle="collapse" data-target="#form-msg"
aria-expanded="false" aria-controls="form-message">
<span class='octicon octicon-comment'></span>
</button>
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#configModal">
See config
</button>
</div>
</div>
</nav>
<div class="row-fluid">
<div class="container">
<div class="collapse" id="form-msg">
<div class="card card-body">
<form action="/post" method="post" accept-charset="utf-8"
enctype="application/x-www-form-urlencoded">
<div class="form-row">
<div class="col">
<input type="text" class="form-control" placeholder="Your name" name="name" required>
</div>
<div class="col">
<input type="text" class="form-control" placeholder="Message" name="msg" required>
<input type="text" class="form-control" name="url" id="url" hidden readonly>
</div>
<div class="col">
<select class="form-control" name="lvl">
<option value="info">Info</option>
<option value="warning">Warning</option>
<option value="danger">Disaster</option>
</select>
</div>
{% include "form.html" %}
<div class="col">
<button id="publish" name="save" class="btn btn-secondary">Publish <span
class="octicon octicon-mail"></span></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="container-fluid">
{% if check_servers %}
<table class='table table-borderless table-sm'>
{% for ip in check_servers%}
{% if not check_servers[ip] %}
<tr class='bg-danger'>
<td class='text-center'>
<h1>/!\ Zabbix Server: {{ ip }} unreachable /!\</h1>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% endif %}
{% if config.ZABBIX_API_LIMIT == total_alerts %}
<table class='table table-borderless table-sm'>
<tr class='bg-danger'>
<td class='text-center'>
<h1>/!\ ZABBIX_API_LIMIT is reached, you will not see all triggers /!\</h1>
</td>
</tr>
</table>
{% endif %}
{% if not accepted_latency %}
<table class='table table-borderless table-sm'>
<tr class='bg-danger'>
<td class='text-center'>
<h1>/!\ Zabbix Server API is taking too much time (ZABBIX_API_ACCEPTED_LATENCY : {{ config.ZABBIX_API_ACCEPTED_LATENCY }}) /!\</h1>
</td>
</tr>
</table>
{% endif %}
{% if not zabbix_available %}
<table class='table table-borderless table-sm'>
<tr class='bg-danger'>
<td class='text-center'>
<h1>/!\ ZABBIX API unreachable /!\</h1>
</td>
</tr>
</table>
{% endif %}
{% if notes %}
<table class='table table-borderless'>
{% for note in notes %}
<tr class='bg-{{note["lvl"]}}'>
<td class='text-left'><span class='octicon octicon-clock'></span> {{ note["date"] }}</td>
<td class='text-center'> {{ note["msg"] }}</td>
<td class='text-right'><span class='octicon octicon-hubot'></span><i> (by {{note["name"]}})</i></td>
<td class='text-right'>
<form action='/del' method='post' accept-charset='utf-8'
enctype='application/x-www-form-urlencoded'><input type='text' class='form-control url_note'
name='url' hidden readonly><input type='text' name='note_id' value='{{note["ts"]}}'
readonly hidden><button type='submit' class='btn btn-outline-light btn-sm del_note'
><span class='octicon octicon-trashcan'></span></button></form>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
<table class="table table-dark table-sm alerts">
{% if alerts|length > 0 %}
{% for alert in alerts %}
{% if alert["priority"] == '5' %}
<tr class="disaster">
{% else %}
<tr>
{% endif %}
<td>
<span class='badge badge-pill'
style='background-color:{{alert["color"]}}'>{{alert["hostgroup"]}}</span>
</td>
<td>{{alert["host"]}}</td>
<td>
{% if alert["acknowledge"]["message"] %}
<i
class="fa fa-info-circle"
data-toggle="tooltip"
data-placement="top"
title='{{ alert["acknowledge"]["username"]}}: {{ alert["acknowledge"]["message"]}}'
>
</i>
{% endif %}
</td>
<td>
{% if alert["url"] %}
<a href='{{ alert["url"] }}' target="_blank" rel="noopener noreferrer">
<i class="fa fa-external-link" aria-hidden="true"></i>
</a>
{% endif %}
</td>
<td>
<a href='{{zabbix_url}}/zabbix.php?action=problem.view&filter_set=1&filter_triggerids%5B%5D={{alert["triggerid"]}}'
target='_blank'>{{alert["description"]}}</a>
</td>
{% if alert["priority"] == '1' %}
<td><span class="badge badge-pill badge-info">1</span></td>
{% elif alert["priority"] == '2' %}
<td><span class="badge badge-pill badge-primary">2</span></td>
{% elif alert["priority"] == '3' %}
<td><span class="badge badge-pill badge-warning">3</span></td>
{% elif alert["priority"] == '4' %}
<td><span class="badge badge-pill badge-danger">4</span></td>
{% elif alert["priority"] == '5' %}
<td><span class="octicon octicon-flame"> </span></td>
{% endif %}
<td>
<span class='badge badge-pill badge-light'>{{alert["since"]}}</span>
</td>
</tr>
{% endfor %}
{%else%}
<div class="container-fluid image-container"><img src="/images/zabbix_logo.png" width="15%" /></div>
{% endif %}
</table>
</div>
</div>
<span id="health-status" class="badge badge-pill badge-success">Super is UP</span>
<script type="text/javascript">
window.tvMode = {{ tv_mode | tojson }};
</script>
<script src="/js/super.js"></script>
</body>
</html>