Pavel Loginov 2020-03-17 19:20:59 +01:00
parent a917523d1f
commit e2c1ebe249
10 changed files with 180 additions and 14 deletions

View File

@ -432,7 +432,7 @@ def update_db_v_42(**kwargs):
def update_ver(**kwargs): def update_ver(**kwargs):
con, cur = get_cur() con, cur = get_cur()
sql = """update version set version = '4.0.0.0'; """ sql = """update version set version = '4.1.0.0'; """
try: try:
cur.execute(sql) cur.execute(sql)
con.commit() con.commit()

View File

@ -75,6 +75,14 @@
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and haproxy_from_wi is defined when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and haproxy_from_wi is defined
- name: Disble SELINUX in config
shell: sed -i 's\SELINUX=enforcing\SELINUX=permissive\' /etc/selinux/config
- name: Disble SELINUX in env
shell: setenforce 0
- name: Enable and start service HAProxy - name: Enable and start service HAProxy
systemd: systemd:
name: haproxy name: haproxy

View File

@ -55,6 +55,14 @@
notify: restart keepalived notify: restart keepalived
- name: Disble SELINUX in config
shell: sed -i 's\SELINUX=enforcing\SELINUX=permissive\' /etc/selinux/config
- name: Disble SELINUX in env
shell: setenforce 0
- name: Enable and start service keepalived - name: Enable and start service keepalived
service: service:
name: keepalived name: keepalived

View File

@ -47,6 +47,15 @@
password: "{{STATS_PASS}}" password: "{{STATS_PASS}}"
when: "'nginx' not in ansible_facts.packages" when: "'nginx' not in ansible_facts.packages"
- name: Disble SELINUX in config
shell: sed -i 's\SELINUX=enforcing\SELINUX=permissive\' /etc/selinux/config
- name: Disble SELINUX in env
shell: setenforce 0
- hosts: "{{ variable_host }}" - hosts: "{{ variable_host }}"
become: yes become: yes
become_method: sudo become_method: sudo

View File

@ -0,0 +1,126 @@
<style>
body { font-family: arial, helvetica, sans-serif; font-size: 12px; font-weight: normal; color: black; background: white;}
th,td { font-size: 10px; }
h1 { font-size: x-large; margin-bottom: 0.5em;}
h2 { font-family: helvetica, arial; font-size: x-large; font-weight: bold; font-style: italic; color: #6020a0; margin-top: 0em; margin-bottom: 0em;}
h3 { font-family: helvetica, arial; font-size: 16px; font-weight: bold; color: #b00040; background: #e8e8d0; margin-top: 0em; margin-bottom: 0em;}
li { margin-top: 0.25em; margin-right: 2em;}
.hr {margin-top: 0.25em; border-color: black; border-bottom-style: solid;}
.titre {background: #20D0D0;color: #000000; font-weight: bold; text-align: center;}
.total {background: #20D0D0;color: #ffff80;}
.frontend {background: #e8e8d0;}
.socket {background: #d0d0d0;}
.backend {background: #e8e8d0;}
.active_down {background: #ff9090;}
.active_going_up {background: #ffd020;}
.active_going_down {background: #ffffa0;}
.active_up {background: #c0ffc0;}
.active_nolb {background: #20a0ff;}
.active_draining {background: #20a0FF;}
.active_no_check {background: #e0e0e0;}
.backup_down {background: #ff9090;}
.backup_going_up {background: #ff80ff;}
.backup_going_down {background: #c060ff;}
.backup_up {background: #b0d0ff;}
.backup_nolb {background: #90b0e0;}
.backup_draining {background: #cc9900;}
.backup_no_check {background: #e0e0e0;}
.maintain {background: #c07820;}
.rls {letter-spacing: 0.2em; margin-right: 1px;}
a.px:link {color: #ffff40; text-decoration: none;}a.px:visited {color: #ffff40; text-decoration: none;}a.px:hover {color: #ffffff; text-decoration: none;}a.lfsb:link {color: #000000; text-decoration: none;}a.lfsb:visited {color: #000000; text-decoration: none;}a.lfsb:hover {color: #505050; text-decoration: none;}
table.tbl { border-collapse: collapse; border-style: none;}
table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}
table.tbl td.ac { text-align: center;}
table.tbl th { border-width: 1px; border-style: solid solid solid solid; border-color: gray; padding-left: 10px;}
table.tbl th.pxname { background: #b00040; color: #ffff40; font-weight: bold; border-style: solid solid none solid; padding: 2px 3px; white-space: nowrap;}
table.tbl th.empty { border-style: none; empty-cells: hide; background: white;}
table.tbl th.desc { background: white; border-style: solid solid none solid; text-align: left; padding: 2px 3px;}
table.lgd { border-collapse: collapse; border-width: 1px; border-style: none none none solid; border-color: black;}
table.lgd td { border-width: 1px; border-style: solid solid solid solid; border-color: gray; padding: 2px;}
table.lgd td.noborder { border-style: none; padding: 2px; white-space: nowrap;}
table.det { border-collapse: collapse; border-style: none; }
table.det th { text-align: left; border-width: 0px; padding: 0px 1px 0px 0px; font-style:normal;font-size:11px;font-weight:bold;font-family: sans-serif;}
table.det td { text-align: right; border-width: 0px; padding: 0px 0px 0px 4px; white-space: nowrap; font-style:normal;font-size:11px;font-weight:normal;}
u {text-decoration:none; border-bottom: 1px dotted black;}
div.tips {
display:block;
visibility:hidden;
z-index:2147483647;
position:absolute;
padding:2px 4px 3px;
background:#f0f060; color:#000000;
border:1px solid #7040c0;
white-space:nowrap;
font-style:normal;font-size:11px;font-weight:normal;
-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;
-moz-box-shadow:gray 2px 2px 3px;-webkit-box-shadow:gray 2px 2px 3px;box-shadow:gray 2px 2px 3px;
}
u:hover div.tips {visibility:visible;}
</style>
{% for l in out %}
<table class="tbl" width="100%">
<tr class="titre">
<th class="pxname" style="background-color: rgb(93, 156, 235); width: 100%; padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
<a name="status">
<a class="px" href="#stats" style="color: rgb(255, 255, 255);">Nginx status</a>
</th>
</tr>
</table>
<table class="tbl" width="100%">
<tr class="titre">
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221); width: 15%;">
{{l.0.0}} {{l.0.1}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.4}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.5}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.6}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.10}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.12}}
</th>
<th style="background-color: rgb(245, 250, 244); padding-top: 4px; padding-bottom: 4px; border-color: rgb(221, 221, 221);">
{{l.0.14}}
</th>
</tr>
<tr class="frontend">
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.2}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.7}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.8}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.9}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.11}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.13}}
</td>
<td style="font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-size: 11px; border-color: rgb(221, 221, 221); padding: 3px;">
{{l.0.15}}
</td>
</tr>
</table>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description about statuses <a href="https://haproxy-wi.org/description.py?description=nginx_status" title="Nginx status page description" target="_blank">here</a>
</div>
{% endfor %}

View File

@ -76,6 +76,7 @@
<ul class="v_menu"> <ul class="v_menu">
<li><a href="/app/hapservers.py?service=nginx" title="Overview Nginx servers" class="overview-link head-submenu">Overview</a> </li> <li><a href="/app/hapservers.py?service=nginx" title="Overview Nginx servers" class="overview-link head-submenu">Overview</a> </li>
<li><a href="/app/config.py?service=nginx" title="Edit Nginx config" class="edit head-submenu">Configs</a></li> <li><a href="/app/config.py?service=nginx" title="Edit Nginx config" class="edit head-submenu">Configs</a></li>
<li><a href="/app/viewsttats.py?service=nginx" title="Show stats" class="stats head-submenu">Stats</a></li>
<li><a href="/app/versions.py?service=nginx" title="Actions with Nginx configs versions" class="version head-submenu">Versions</a></li> <li><a href="/app/versions.py?service=nginx" title="Actions with Nginx configs versions" class="version head-submenu">Versions</a></li>
</ul> </ul>
</li> </li>

View File

@ -37,10 +37,12 @@
<script src="/inc/chart.min.js"></script> <script src="/inc/chart.min.js"></script>
<script> <script>
function showMetrics() { function showMetrics() {
{% for s in servers %} {% if service == 'haproxy' %}
getChartData('{{s.2}}') {% for s in servers %}
getWafChartData('{{s.2}}') getChartData('{{s.2}}')
{% endfor %} getWafChartData('{{s.2}}')
{% endfor %}
{% endif %}
showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}'); showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}');
} }
showMetrics(); showMetrics();
@ -155,10 +157,10 @@
{% endif %} {% endif %}
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a> <a href="/app/config.py?service={{service}}&serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a>
{% if service != 'nginx' %} {% if service != 'nginx' %}
<a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map">Map</a> <a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map">Map</a>
<a href="/app/viewsttats.py?serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View stat">Stat</a>
{% endif %} {% endif %}
<a href="/app/logs.py?service={{service}}&serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" class="ui-button ui-widget ui-corner-all" title="View log">Log</a> <a href="/app/viewsttats.py?service={{service}}&serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View stat">Stat</a>
<a href="/app/logs.py?service={{service}}&serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" class="ui-button ui-widget ui-corner-all" title="View log">Log</a>
{% if role <= 2 %} {% if role <= 2 %}
<a href="/app/versions.py?service={{service}}&serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all">Versions</a> <a href="/app/versions.py?service={{service}}&serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all">Versions</a>
{% endif %} {% endif %}
@ -166,17 +168,19 @@
</div> </div>
{% if serv %} {% if serv %}
<div id="ajax-server-{{s.0}}" class="ajax-server"></div> <div id="ajax-server-{{s.0}}" class="ajax-server"></div>
<div class="div-server div-backends"> {% if service == 'haproxy' %}
<div class="div-server div-backends">
<div class="server-name backends"> <div class="server-name backends">
Backends: Backends:
</div> </div>
<div style="margin-top: 10px;" id="top-{{s.1}}"></div> <div style="margin-top: 10px;" id="top-{{s.1}}"></div>
</div> </div>
{% endif %}
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% if serv %} {% if serv and service == 'haproxy' %}
<div id="refresh" style="text-align: right;margin-right: 105px;clear: both;display: block;padding-top: 20px;margin-bottom: -25px;" title="Refresh metrics" onclick="showMetrics()"> <div id="refresh" style="text-align: right;margin-right: 105px;clear: both;display: block;padding-top: 20px;margin-bottom: -25px;" title="Refresh metrics" onclick="showMetrics()">
<span class="service-reload"></span> <span class="service-reload"></span>
</div> </div>
@ -193,7 +197,7 @@
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
</div> </div>
<script> <script>
{% if serv %} {% if serv and service == 'haproxy' %}
overviewHapserverBackends(ip, hostnamea); overviewHapserverBackends(ip, hostnamea);
{% endif %} {% endif %}
showHapservers(ip, hostnamea, '{{service}}'); showHapservers(ip, hostnamea, '{{service}}');

View File

@ -287,8 +287,8 @@
</td> </td>
<td class="padding10 first-collumn" style="width: 20%;"> <td class="padding10 first-collumn" style="width: 20%;">
{% set values = dict() %} {% set values = dict() %}
{% set values = {'2.0.5-1':'2.0.5-1','2.0.6-1':'2.0.6-1', '2.0.7-1':'2.0.7-1', '2.0.9-1':'2.0.9-1', '2.0.11-1':'2.0.11-1', '2.0.12-1':'2.0.12-1'} %} {% set values = {'2.0.5-1':'2.0.5-1','2.0.6-1':'2.0.6-1', '2.0.7-1':'2.0.7-1', '2.0.9-1':'2.0.9-1', '2.0.11-1':'2.0.11-1', '2.0.12-1':'2.0.12-1', '2.0.13-1':'2.0.13-1'} %}
{{ select('hapver', values=values, selected='2.0.11-1', required='required') }} {{ select('hapver', values=values, selected='2.0.13-1', required='required') }}
</td> </td>
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
<select autofocus required name="haproxyaddserv" id="haproxyaddserv"> <select autofocus required name="haproxyaddserv" id="haproxyaddserv">

View File

@ -2,6 +2,7 @@
{% block content %} {% block content %}
<br /> <br />
<form style="padding-left: 5px;" action="viewsttats.py" method="post"> <form style="padding-left: 5px;" action="viewsttats.py" method="post">
<input type="hidden" id="service" value="{{service}}" />
<select autofocus required name="serv" id="serv"> <select autofocus required name="serv" id="serv">
<option disabled>Choose server</option> <option disabled>Choose server</option>
{% for select in selects %} {% for select in selects %}

View File

@ -64,6 +64,15 @@ $( function() {
$(this).parent().find('a').css('padding-left', '20px'); $(this).parent().find('a').css('padding-left', '20px');
$(this).find('a').css('padding-left', '30px'); $(this).find('a').css('padding-left', '30px');
$(this).find('a').css('border-left', '4px solid #5D9CEB'); $(this).find('a').css('border-left', '4px solid #5D9CEB');
} else if(cur_url[0] == 'viewsttats.py' && cur_url[1].split('&')[0] == 'service=nginx' && link2 == 'viewsttats.py?service=nginx'){
$(this).parent().css('display', 'contents');
$(this).parent().css('font-size', '13px');
$(this).parent().css('top', '0');
$(this).parent().css('left', '0');
$(this).parent().children().css('margin-left', '-20px');
$(this).parent().find('a').css('padding-left', '20px');
$(this).find('a').css('padding-left', '30px');
$(this).find('a').css('border-left', '4px solid #5D9CEB');
} }
}); });
}); });