mirror of https://github.com/Aidaho12/haproxy-wi
434 lines
23 KiB
HTML
434 lines
23 KiB
HTML
{% from 'include/input_macros.html' import input, select, checkbox %}
|
|
{% if user_status == 0 %}
|
|
{% include 'include/no_sub.html' %}
|
|
{% else %}
|
|
<script>
|
|
$( "#checker_tabs" ).tabs();
|
|
</script>
|
|
<style>
|
|
.checker_settings_table {
|
|
margin-bottom: 15px;
|
|
}
|
|
</style>
|
|
{% for s in services %}
|
|
{% if s.0 == 'roxy-wi-checker' %}
|
|
{% if s.3 == '* is not installed' and s.3 == '' %}
|
|
<div style="text-align: center;">
|
|
<br />
|
|
<h3>You have not installed Backends checker
|
|
Read <a href="https://roxy-wi.org/services/checker#installation" title="Checker installation" style="color: #5d9ceb;" target="_blank">hear</a>
|
|
how to install Checker service</h3>
|
|
</div>
|
|
{% else %}
|
|
<div id="checker_tabs">
|
|
<ul id="checker-tabs-head">
|
|
<li><a href="#channels" title="Checker channels - Roxy-WI">Channels</a></li>
|
|
<li><a href="#checker_settings" title="Checker settings - Roxy-WI">Settings</a></li>
|
|
</ul>
|
|
<div id="channels">
|
|
<table id="checker_table" class="overview">
|
|
<caption><h3>Telegram channels</h3></caption>
|
|
<tr class="overviewHead" style="width: 50%;">
|
|
<td class="padding10 first-collumn" style="width: 25%;">
|
|
<span title="Token that has given @father_bot">Token</span>
|
|
</td>
|
|
<td style="width: 20%;">Channel name</td>
|
|
{% if page != "servers.py" %}
|
|
<td style="width: 25%;">Group</td>
|
|
{% endif %}
|
|
<td style="width: 100%;"></td>
|
|
<td></td>
|
|
<td><span onclick="loadchecker()" class="refresh" title="Reload Telegram channels"></span></td>
|
|
</tr>
|
|
{% for telegram in telegrams %}
|
|
<tr id="telegram-table-{{telegram.id}}" class="{{ loop.cycle('odd', 'even') }}">
|
|
<td class="padding10 first-collumn">
|
|
{% set id = 'telegram-token-' + telegram.id|string() %}
|
|
{{ input(id, value=telegram.token, size='30') }}
|
|
</td>
|
|
<td>
|
|
{% set id = 'telegram-chanel-' + telegram.id|string() %}
|
|
{{ input(id, value=telegram.chanel_name, size='30') }}
|
|
</td>
|
|
{% if page != "servers.py" %}
|
|
<td>
|
|
<select id="telegramgroup-{{telegram.id}}" name="telegramgroup-{{telegram.id}}">
|
|
<option disabled selected>Choose group</option>
|
|
{% for group in groups %}
|
|
{% if telegram.groups|string() == group.group_id|string() %}
|
|
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
|
|
{% else %}
|
|
<option value="{{ group.group_id }}">{{ group.name }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
{% endif %}
|
|
<td>
|
|
<button title="Send a test message" onclick="checkTelegram({{telegram.id}})">Test</button>
|
|
</td>
|
|
<td>
|
|
<a class="add" onclick="cloneTelegram({{telegram.id}})" id="clone-{{telegram.id}}" title="Copy the settings from {{telegram.chanel_name}}" style="cursor: pointer;"></a>
|
|
</td>
|
|
<td>
|
|
<a class="delete" onclick="confirmDeleteTelegram({{telegram.id}})" title="Delete channel {{telegram.chanel_name}}" style="cursor: pointer;"></a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
<br /><span class="add-button" title="Add telegram channel" id="add-telegram-button">+ Add</span>
|
|
<br /><br />
|
|
<table id="checker_slack_table" class="overview">
|
|
<caption><h3>Slack channels</h3></caption>
|
|
<tr class="overviewHead" style="width: 50%;">
|
|
<td class="padding10 first-collumn" style="width: 25%;">
|
|
<span title="Token that has given with APP registration">Token</span>
|
|
</td>
|
|
<td style="width: 20%;">Channel name</td>
|
|
{% if page != "servers.py" %}
|
|
<td style="width: 25%;">Group</td>
|
|
{% endif %}
|
|
<td style="width: 100%;"></td>
|
|
<td></td>
|
|
<td><span onclick="loadchecker()" class="refresh" title="Reload Slack channels"></span></td>
|
|
</tr>
|
|
{% for slack in slacks %}
|
|
<tr id="slack-table-{{slack.id}}" class="{{ loop.cycle('odd', 'even') }}">
|
|
<td class="padding10 first-collumn">
|
|
{% set id = 'slack-token-' + slack.id|string() %}
|
|
{{ input(id, value=slack.token, size='30') }}
|
|
</td>
|
|
<td>
|
|
{% set id = 'slack-chanel-' + slack.id|string() %}
|
|
{{ input(id, value=slack.chanel_name, size='30') }}
|
|
</td>
|
|
{% if page != "servers.py" %}
|
|
<td>
|
|
<select id="slackgroup-{{slack.id}}" name="slackgroup-{{slack.id}}">
|
|
<option disabled selected>Choose group</option>
|
|
{% for group in groups %}
|
|
{% if slack.groups|string() == group.group_id|string() %}
|
|
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
|
|
{% else %}
|
|
<option value="{{ group.group_id }}">{{ group.name }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
{% endif %}
|
|
<td>
|
|
<button title="Send a test message" onclick="checkSlack({{slack.id}})">Test</button>
|
|
</td>
|
|
<td>
|
|
<a class="add" onclick="cloneSlack({{slack.id}})" id="clone-{{slack.id}}" title="Clone {{slack.chanel_name}}" style="cursor: pointer;"></a>
|
|
</td>
|
|
<td>
|
|
<a class="delete" onclick="confirmDeleteSlack({{slack.id}})" title="Delete channel {{slack.chanel_name}}" style="cursor: pointer;"></a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
<br /><span class="add-button" title="Add Slack channel" id="add-slack-button">+ Add</span>
|
|
<br /><br />
|
|
<table class="overview">
|
|
<caption><h3>Test messages</h3></caption>
|
|
<tr class="overviewHead">
|
|
<td class="padding10 first-collumn" style="width: 45%">Email</td>
|
|
<td style="width: 100%">Web panel</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="padding10 first-collumn">
|
|
<button title="Send a test message via Email" onclick="checkEmail()">Test</button>
|
|
</td>
|
|
<td>
|
|
<button title="Send a test message via Web panel" onclick="checkWebPanel()">Test</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br /><br />
|
|
<div id="ajax-telegram"></div>
|
|
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
|
|
You can read the description of all parameters <a href="https://roxy-wi.org/description/checker" title="Servers description" target="_blank">here</a>,
|
|
How to create and use Telegram bot in this <a href="https://roxy-wi.org/howto/create-telegram-bot" title="How to create Telegram bot and use it with Roxy-WI" target="_blank">article</a>,
|
|
How to create and use Slack APP in this <a href="https://roxy-wi.org/howto/create-slack-app" title="How to create Slack APP and use it with Roxy-WI" target="_blank">article</a>
|
|
</div>
|
|
</div>
|
|
<div id="checker_settings">
|
|
<table class="overview checker_settings_table" id="checker_haproxy_table">
|
|
<caption><h3>HAProxy servers</h3></caption>
|
|
<tr class="overviewHead">
|
|
<td class="padding10 first-collumn">Server</td>
|
|
<td class="first-collumn" title="Alert via Telegram">Telegram</td>
|
|
<td class="first-collumn" title="Alert via Slack">Slack</td>
|
|
<td class="checkbox-head" style="width: 10%;" title="Alert via email">Email</td>
|
|
<td class="checkbox-head" style="width: 10%;" title="Alert about changing service status">Service</td>
|
|
<td class="checkbox-head" style="width: 10%;" title="Alert about changing backend status">Backend</td>
|
|
<td class="checkbox-head" style="width: 100%;" title="Alert if the number of connections is about to reach the limit">Maxconn</td>
|
|
<td><span onclick="loadchecker(1)" class="refresh" title="Reload"></span></td>
|
|
</tr>
|
|
{% for s in haproxy_servers %}
|
|
{% for h in haproxy_settings %}
|
|
{% if h.server_id|string() == s.0|string() and h.service_id == 1 %}
|
|
<tr id="haproxy_server_tr_id-{{h.id}}">
|
|
<td class="padding10 first-collumn" id="haproxy_server_name-{{h.id}}">{{s.1}}</td>
|
|
<td id="haproxy_server_telegram-{{h.id}}" title="Alert via this channel">
|
|
<select id="haproxy_server_telegram_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in telegrams %}
|
|
{% if h.telegram_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td id="haproxy_server_slack-{{s.0}}" title="Alert via this channel">
|
|
<select id="haproxy_server_slack_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in slacks %}
|
|
{% if h.slack_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td class="checkbox" title="Alert via email">
|
|
{% set id = 'haproxy_server_email-' + h.id|string() %}
|
|
{% if h.email == 1 %}
|
|
{{ checkbox(id, checked='checked') }}
|
|
{% else %}
|
|
{{ checkbox(id) }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'haproxy_server_status-' + h.id|string() %}
|
|
{% if h.service_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing service status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing service status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'haproxy_server_backend-' + h.id|string() %}
|
|
{% if h.backend_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing backend status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing backend status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'haproxy_server_maxconn-' + h.id|string() %}
|
|
{% if h.maxconn_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert if the number of connections is about to reach the limit') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert if the number of connections is about to reach the limit') }}
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</table>
|
|
<table class="overview checker_settings_table" id="checker_nginx_table">
|
|
<caption><h3>NGINX servers</h3></caption>
|
|
<tr class="overviewHead">
|
|
<td class="padding10 first-collumn">Server</td>
|
|
<td class="first-collumn" title="Alert via Telegram">Telegram</td>
|
|
<td class="first-collumn" title="Alert via Slack">Slack</td>
|
|
<td class="checkbox-head" style="width: 10%;" title="Alert via Email">Email</td>
|
|
<td class="checkbox-head" style="width: 100%;" title="Alert about changing service status">Service</td>
|
|
<td><span onclick="loadchecker(1)" class="refresh" title="Reload"></span></td>
|
|
</tr>
|
|
{% for s in nginx_servers %}
|
|
{% for h in nginx_settings %}
|
|
{% if h.server_id|string() == s.0|string() and h.service_id == 2 %}
|
|
<tr id="nginx_server_tr_id-{{h.id}}">
|
|
<td class="padding10 first-collumn" id="nginx_server_name-{{h.id}}">{{s.1}}</td>
|
|
<td id="nginx_server_telegram-{{h.id}}" title="Alert via this channel">
|
|
<select id="nginx_server_telegram_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in telegrams %}
|
|
{% if h.telegram_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td id="nginx_server_slack-{{h.id}}" title="Alert via this channel">
|
|
<select id="nginx_server_slack_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in slacks %}
|
|
{% if h.slack_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'nginx_server_email-' + h.id|string() %}
|
|
{% if h.email == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert via email') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert via email') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'nginx_server_status-' + h.id|string() %}
|
|
{% if h.service_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing service status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing service status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</table>
|
|
<table class="overview checker_settings_table" id="checker_apache_table">
|
|
<caption><h3>Apache servers</h3></caption>
|
|
<tr class="overviewHead">
|
|
<td class="padding10 first-collumn">Server</td>
|
|
<td class="first-collumn" title="Alert via Telegram">Telegram</td>
|
|
<td class="first-collumn" title="Alert via Slack">Slack</td>
|
|
<td class="checkbox-head" style="width: 10%;">Email</td>
|
|
<td class="checkbox-head" style="width: 100%;" title="Alert about changing service status">Service</td>
|
|
<td><span onclick="loadchecker(1)" class="refresh" title="Reload"></span></td>
|
|
</tr>
|
|
{% for s in apache_servers %}
|
|
{% for h in apache_settings %}
|
|
{% if h.server_id|string() == s.0|string() and h.service_id == 4 %}
|
|
<tr id="apache_server_tr_id-{{h.id}}">
|
|
<td class="padding10 first-collumn" id="apache_server_name-{{h.id}}">{{s.1}}</td>
|
|
<td id="apache_server_telegram-{{h.id}}" title="Alert via this channel">
|
|
<select id="apache_server_telegram_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in telegrams %}
|
|
{% if h.telegram_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td id="apache_server_slack-{{h.id}}" title="Alert via this channel">
|
|
<select id="apache_server_slack_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in slacks %}
|
|
{% if h.slack_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'apache_server_email-' + h.id|string() %}
|
|
{% if h.email == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert via email') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert via email') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'apache_server_status-' + h.id|string() %}
|
|
{% if h.service_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing service status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing service status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</table>
|
|
<table class="overview checker_settings_table" id="checker_keepalived_table">
|
|
<caption><h3>Keepalived servers</h3></caption>
|
|
<tr class="overviewHead">
|
|
<td class="padding10 first-collumn">Server</td>
|
|
<td class="first-collumn" title="Alert via Telegram">Telegram</td>
|
|
<td class="first-collumn" title="Alert via Slack">Slack</td>
|
|
<td class="checkbox-head" style="width: 10%;">Email</td>
|
|
<td class="checkbox-head" style="width: 10%;" title="Alert about changing service status">Service</td>
|
|
<td class="checkbox-head" style="width: 100%;" title="Alert about changing Master/Backup status">Status</td>
|
|
<td><span onclick="loadchecker(1)" class="refresh" title="Reload"></span></td>
|
|
</tr>
|
|
{% for s in keepalived_servers %}
|
|
{% for h in keepalived_settings %}
|
|
{% if h.server_id|string() == s.0|string() and h.service_id == 3 %}
|
|
<tr id="keepalived_server_tr_id-{{h.id}}">
|
|
<td class="padding10 first-collumn" id="keepalived_server_name-{{h.id}}">{{s.1}}</td>
|
|
<td id="keepalived_server_telegram-{{h.id}}" title="Alert via this channel">
|
|
<select id="keepalived_server_telegram_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in telegrams %}
|
|
{% if h.telegram_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td id="keepalived_server_slack-{{h.id}}" title="Alert via this channel">
|
|
<select id="keepalived_server_slack_channel-{{h.id}}">
|
|
<option value="0">Disabled</option>
|
|
{% for t in slacks %}
|
|
{% if h.slack_id|int() == t.id|int() %}
|
|
<option value="{{t.id}}" selected>{{t.chanel_name}}</option>
|
|
{% else %}
|
|
<option value="{{t.id}}">{{t.chanel_name}}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'keepalived_server_email-' + h.id|string() %}
|
|
{% if h.email == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert via email') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert via email') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'keepalived_server_status-' + h.id|string() %}
|
|
{% if h.service_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing service status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing service status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="checkbox">
|
|
{% set id = 'keepalived_server_backend-' + h.id|string() %}
|
|
{% if h.backend_alert == 1 %}
|
|
{{ checkbox(id, checked='checked', title='Alert about changing Master/Backup status') }}
|
|
{% else %}
|
|
{{ checkbox(id, title='Alert about changing Master/Backup status') }}
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|