haproxy-wi/app/templates/smon.html

172 lines
6.3 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block h2 %}{{ title }}{% endblock %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
<script src="/inc/smon.js"></script>
<script src="/inc/users.js"></script>
<script src="/inc/fontawesome.min.js"></script>
<script src="/inc/jquery.timeago.js" type="text/javascript"></script>
{% if user_status == 0 %}
{% include 'include/no_sub.html' %}
{% elif smon_error != '' %}
<div style="text-align: center;">
<br />
<h3>{{lang.smon_page.desc.not_installed}}</h3>.
<img src="/inc/images/no_servers.png" alt="There is no server">
<h4>{{lang.words.read|title()}} <a href="https://roxy-wi.org/services/smon" title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">{{lang.words.here}}</a>
{{lang.phrases.how_to_install}} SMON {{lang.words.service}}.</h4>
</div>
{% elif smon_status.0 == 'failed' or smon_status.0 == 'inactive' %}
<div style="text-align: center;">
<br />
<h3>{{lang.smon_page.desc.smon_is_not_run}}</h3>
<img src="/inc/images/no_servers.png" alt="There is no server">
<h4>{{lang.smon_page.desc.run_smon}} <a href="users.py#services" title="Roxy-WI services" target="_blank">{{lang.words.here}}</a> {{lang.smon_page.desc.before_use}}</h4>
</div>
{% elif smon|length == 0 and action != 'add' and action != 'history' and action != 'checker_history' %}
<div style="text-align: center;">
<br />
<h3>{{lang.smon_page.desc.not_added}}</h3>
<img src="/inc/images/no_servers.png" alt="There is no server">
<h4>{{lang.smon_page.desc.create_server}} <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">{{lang.words.here}}</a> {{lang.smon_page.desc.before_use}}</h4>
<br />
</div>
{% elif smon|length == 0 and action != 'add' and action == 'history' %}
<div style="text-align: center;">
<br />
<h3>{{lang.phrases.no_events_added}}</h3>
<img src="/inc/images/no_servers.png" alt="There is no server">
<h4>Click <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">{{lang.words.here}}</a> {{lang.smon_page.desc.see_check}}</h4>
<br />
</div>
{% elif smon|length == 0 and action != 'add' and action == 'checker_history' %}
<div style="text-align: center;">
<br />
<h3>
{{lang.phrases.no_events_added}} Check if there are any Checker are enabled on the "<a href="hapservers.py?service=haproxy" title="HAProxy Overview">HAProxy {{lang.menu_links.hapservers.link}}</a>"
{{lang.words.or}} {{lang.words.on}} "<a href="hapservers.py?service=nginx" title="NGINX Overview">NGINX {{lang.menu_links.hapservers.link}}</a>"
{{lang.words.or}} {{lang.words.on}} "<a href="hapservers.py?service=apache" title="Apache Overview">Apache {{lang.menu_links.hapservers.link}}</a>"
{{lang.words.or}} {{lang.words.on}} "<a href="hapservers.py?service=keepalived" title="Keepalived Overview">Keepalived {{lang.menu_links.hapservers.link}}</a>" {{lang.words.pages}}
</h3>
<br />
</div>
{% else %}
{% if action == 'add' %}
<table class="overview" id="ajax-smon">
<thead>
<tr class="overviewHead">
<th class="padding10 first-collumn" style="width: 150px;">IP</th>
<th style="width: 2%;">{{lang.words.port|title()}}</th>
<th style="width: 5%;">{{lang.words.enabled|title()}}</th>
<th style="width: 10%;">{{lang.words.protocol|title()}}</th>
<th style="width: 15%;">URI</th>
<th style="width: 20%;">{{lang.words.body|title()}}</th>
<th style="width: 15%;">Telegram</th>
<th style="width: 15%;">Slack</th>
<th style="width: 10%;">{{lang.words.group|title()}}</th>
<th style="width: 100%;">{{lang.words.desc|title()}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{env}}
{% for s in smon %}
<tr id="smon-{{s.0}}">
{% include 'include/smon_server.html' %}
{% endfor %}
</tbody>
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} {{lang.words.w_a}} {{lang.words.new}} {{lang.words.server}}" id="add-smon-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<div id="ajax"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
{{lang.phrases.read_about_parameters}} <a href="https://roxy-wi.org/services/smon" title="SMON service description" target="_blank">{{lang.words.here}}</a>
</div>
<div id="smon-add-table" style="display: none;">
<table class="overview">
{% include 'include/tr_validate_tips.html' %}
<tr>
<td class="padding20">
IP
<span class="need-field">*</span>
</td>
<td>
{{ input('new-smon-ip') }}
</td>
</tr>
<tr>
<td class="padding20">
{{lang.words.port|title()}}
<span class="need-field">*</span>
</td>
<td>
{{ input('new-smon-port', type='number', size='4') }}
</td>
</tr>
<tr>
<td class="padding20">{{lang.words.enable|title()}}</td>
<td>
{{ checkbox('new-smon-enable', checked='checked') }}
</td>
</tr>
<tr>
<td class="padding20">{{lang.words.protocol|title()}}</td>
<td>
{% set values = dict() %}
{% set values = {'':'', 'http':'http','https':'https'} %}
{{ select('new-smon-proto', values=values, selected='') }}
</td>
</tr>
<tr>
<td class="padding20">URI</td>
<td>{{ input('new-smon-uri') }}</td>
</tr>
<tr>
<td class="padding20">{{lang.words.body|title()}}</td>
<td>{{ input('new-smon-body') }}</td>
</tr>
<tr>
<td class="padding20">Telegram</td>
<td>
<select id="new-smon-telegram">
<option value="0">{{lang.words.disabled|title()}}</option>
{% for t in telegrams %}
<option value="{{t.id}}">{{t.chanel_name}}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">Slack</td>
<td>
<select id="new-smon-slack">
<option value="0">{{lang.words.disabled|title()}}</option>
{% for t in slacks %}
<option value="{{t.id}}">{{t.chanel_name}}</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding20">{{lang.words.group|title()}}</td>
<td>{{ input('new-smon-group') }}</td>
</tr>
<tr>
<td class="padding20">{{lang.words.desc|title()}}</td>
<td>{{ input('new-smon-description') }}</td>
</tr>
</table>
{% include 'include/del_confirm.html' %}
{% elif action == 'history' or action == 'checker_history' %}
{% include 'ajax/alerts_history.html' %}
{% else %}
<div class="main" id="smon_dashboard">
{% include 'ajax/smon_dashboard.html' %}
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}