mirror of https://github.com/Aidaho12/haproxy-wi
v3.5.1
parent
a86c7a0d25
commit
5f8cd37f7c
|
@ -783,7 +783,7 @@ def select_waf_servers_metrics(uuid, **kwargs):
|
|||
else:
|
||||
for group in cur:
|
||||
if group[5] == '1':
|
||||
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 and waf.metrics = '1' """
|
||||
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 and waf.metrics = '1' """
|
||||
else:
|
||||
sql = """ select servers.ip from servers left join waf as waf on waf.server_id = servers.id where servers.enable = 1 and waf.metrics = '1' and servers.groups like '%{group}%' """.format(group=group[5])
|
||||
try:
|
||||
|
@ -797,7 +797,7 @@ def select_waf_servers_metrics(uuid, **kwargs):
|
|||
|
||||
def select_waf_metrics(serv, **kwargs):
|
||||
con, cur = create_db.get_cur()
|
||||
sql = """ select * from waf_metrics where serv = '%s' order by `date` desc """ % serv
|
||||
sql = """ select * from (select * from waf_metrics where serv = '%s' order by `date` desc limit 30) order by `date`""" % serv
|
||||
try:
|
||||
cur.execute(sql)
|
||||
except sqltool.Error as e:
|
||||
|
|
|
@ -16,6 +16,9 @@ th, tr, td {
|
|||
<script src="/inc/metrics.js"></script>
|
||||
<script src="/inc/chart.min.js"></script>
|
||||
<div id="table_metrics"></div>
|
||||
<div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 10px;" title="Refresh metrics" onclick="showMetrics()">
|
||||
<img src="/inc/images/update.png" alt="Refresh" class="icon">
|
||||
</div>
|
||||
{% for s in servers %}
|
||||
<div class="chart-container">
|
||||
<canvas id="{{s.0}}" role="img"></canvas>
|
||||
|
|
|
@ -28,10 +28,12 @@
|
|||
<link href="/inc/chart.min.css" rel="stylesheet">
|
||||
<script src="/inc/metrics.js"></script>
|
||||
<script src="/inc/chart.min.js"></script>
|
||||
|
||||
<div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 20px;" title="Refresh metrics" onclick="showWafMetrics()">
|
||||
<img src="/inc/images/update.png" alt="Refresh" class="icon">
|
||||
</div>
|
||||
{% for s in servers %}
|
||||
<div class="chart-container">
|
||||
<canvas id="{{s.0}}" role="img"></canvas>
|
||||
<canvas id="s_{{s.0}}" role="img"></canvas>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
|
|
@ -81,10 +81,8 @@ function getWafChartData(server) {
|
|||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function (result) {
|
||||
|
||||
success: function (result) {
|
||||
var data = [];
|
||||
|
||||
data.push(result.chartData.curr_con);
|
||||
data.push(result.chartData.server);
|
||||
var labels = result.chartData.labels;
|
||||
|
@ -93,7 +91,8 @@ function getWafChartData(server) {
|
|||
});
|
||||
}
|
||||
function renderWafChart(data, labels, server) {
|
||||
var ctx = document.getElementById(server)
|
||||
console.log(server)
|
||||
var ctx = 's_'+server
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
|
|
|
@ -150,7 +150,7 @@ function startSetInterval(interval) {
|
|||
if(interval < 60000) {
|
||||
interval = 60000;
|
||||
}
|
||||
intervalId = setInterval('showMetrics()', interval);
|
||||
intervalId = setInterval('showOverviewWaf()', interval);
|
||||
showOverviewWaf();
|
||||
showWafMetrics();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue