mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
formatted footer.lua and removed styles from ntopng.css, degraded perfomance shown between views
This commit is contained in:
parent
64d69caf60
commit
53af58c9d0
3 changed files with 187 additions and 214 deletions
|
|
@ -34,26 +34,25 @@ if not interface.isPcapDumpInterface() and not have_nedge then
|
|||
end
|
||||
end -- closes interface.isPcapDumpInterface() == false
|
||||
|
||||
print [[
|
||||
<div id="footer">
|
||||
<hr>
|
||||
print ([[
|
||||
<div id="n-footer" class="border-top">
|
||||
<div class="container-fluid"> <!-- occupy the whole row -->
|
||||
<div class="row">
|
||||
<div class="row mt-2">
|
||||
<div class="col-4 text-left">
|
||||
<small>
|
||||
<a href="https://www.ntop.org/products/traffic-analysis/ntop/" target="_blank">
|
||||
]] .. (info.product .. ' ' .. getNtopngRelease(info) .." Edition v.".. info.version) ..[[
|
||||
</a>
|
||||
|
|
||||
<a href="https://github.com/ntop/ntopng"><i class="fab fa-github"></i></a>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<small>]].. ntop.getInfo()["copyright"] ..[[</small>
|
||||
<p id="ntopng_update_available"></p>
|
||||
]])
|
||||
|
||||
|
||||
<div class="col-4 text-left">
|
||||
<small><a href="https://www.ntop.org/products/traffic-analysis/ntop/" target="_blank">]]
|
||||
print(info.product .. ' ' .. getNtopngRelease(info) .." Edition v.".. info.version)
|
||||
print [[ </a>
|
||||
| <a href="https://github.com/ntop/ntopng"> <i class="fab fa-github"></i> </A></small>
|
||||
</div>
|
||||
|
||||
<div class="col-4 text-center">
|
||||
]]
|
||||
|
||||
local info = ntop.getInfo()
|
||||
print("<small>"..info["copyright"].."</small>")
|
||||
|
||||
-- center element
|
||||
|
||||
if(info["pro.systemid"] and (info["pro.systemid"] ~= "")) then
|
||||
|
|
@ -75,37 +74,32 @@ if(info["pro.systemid"] and (info["pro.systemid"] ~= "")) then
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
print [[
|
||||
</div>
|
||||
|
||||
<div class="col-4 text-right">
|
||||
<small>
|
||||
<div class="text-right">
|
||||
<i class="fas fa-clock"></i> <div class="d-inline-block" id='network-clock'></div> | ]]
|
||||
print(i18n("about.uptime")) print[[: <div class="d-inline-block" id='network-uptime'></div>
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<small>
|
||||
<div class="text-right">
|
||||
<i class="fas fa-clock"></i> <div class="d-inline-block" id='network-clock'></div> | ]] print(i18n("about.uptime")) print[[: <div class="d-inline-block" id='network-uptime'></div>
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="ntopng_update_available"></p>
|
||||
</div>
|
||||
]]
|
||||
|
||||
local traffic_peity_width = "64"
|
||||
|
||||
if ts_utils.getDriverName() == "influxdb" then
|
||||
local msg = ntop.getCache("ntopng.cache.influxdb.last_error")
|
||||
|
||||
local msg = ntop.getCache("ntopng.cache.influxdb.last_error")
|
||||
if not isEmptyString(msg) then
|
||||
print[[
|
||||
<script>
|
||||
$("#influxdb-error-msg-text").html("]] print(msg:gsub('"', '\\"')) print[[");
|
||||
$("#influxdb-error-msg").show();
|
||||
</script>
|
||||
]]
|
||||
print([[
|
||||
<script type="text/javascript">
|
||||
$("#influxdb-error-msg-text").html("]].. (msg:gsub('"', '\\"')) ..[[");
|
||||
$("#influxdb-error-msg").show();
|
||||
</script>
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -114,8 +108,11 @@ local message_enabled = (areHostL7TimeseriesEnabled(ifid) or areHostCategoriesTi
|
|||
(ts_utils.getDriverName() ~= "influxdb") and
|
||||
(ntop.getPref("ntopng.prefs.disable_ts_migration_message") ~= "1")
|
||||
|
||||
print('<script>\nvar is_historical = false;')
|
||||
|
||||
print [[
|
||||
<script type="text/javascript">
|
||||
var is_historical = false;
|
||||
|
||||
function checkMigrationMessage(data) {
|
||||
var max_local_hosts = 500;
|
||||
var enabled = ]] print(ternary(message_enabled, "true", "false")) print[[;
|
||||
|
|
@ -126,16 +123,14 @@ function checkMigrationMessage(data) {
|
|||
|
||||
$("#move-rrd-to-influxdb, #host-id-message-warning, #influxdb-error-msg").on("close.bs.alert", function() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ']]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/update_prefs.lua',
|
||||
data: {
|
||||
csrf: ']] print(ntop.getRandomCSRFValue()) print[[',
|
||||
action: this.id,
|
||||
ifid: ]] print(string.format("%u", _ifstats.id)) print[[,
|
||||
}
|
||||
});
|
||||
type: 'POST',
|
||||
url: ']] print (ntop.getHttpPrefix()) print [[/lua/update_prefs.lua',
|
||||
data: {
|
||||
csrf: ']] print(ntop.getRandomCSRFValue()) print[[',
|
||||
action: this.id,
|
||||
ifid: ]] print(string.format("%u", _ifstats.id)) print[[,
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var updatingChart_upload = $(".network-load-chart-upload").show().peity("line", { width: ]] print(traffic_peity_width) print[[, max: null });
|
||||
|
|
@ -145,15 +140,10 @@ var updatingChart_total = $(".network-load-chart-total").show().peity("line", {
|
|||
var footerRefresh = function() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ']]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/rest/get/interface/data.lua',
|
||||
url: ']]print (ntop.getHttpPrefix()) print [[/lua/rest/get/interface/data.lua',
|
||||
data: { ifid: ]] print(tostring(ifid)) print[[ },
|
||||
/* error: function(content) { alert("JSON Error (session expired?): logging out"); window.location.replace("]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/logout.lua"); }, */
|
||||
/* error: function(content) { alert("JSON Error (session expired?): logging out"); window.location.replace("]] print (ntop.getHttpPrefix()) print [[/lua/logout.lua"); }, */
|
||||
success: function(rsp) {
|
||||
|
||||
try {
|
||||
var values = updatingChart_upload.text().split(",")
|
||||
var values1 = updatingChart_download.text().split(",")
|
||||
|
|
@ -191,7 +181,6 @@ if (interface.isPcapDumpInterface() == false) and (not have_nedge) then
|
|||
var v = Math.round(Math.min((bps*100)/]] print(maxSpeed) print[[, 100));
|
||||
//$('#networkload').css("width", v+"%")
|
||||
$('#networkload').html(v+"%");
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
|
@ -201,29 +190,31 @@ print[[
|
|||
//$('#chart-total-text').html(""+bitsToSize(Math.min(bps, ]] print(maxSpeed) print[[), 1000));
|
||||
]]
|
||||
|
||||
-- system_view_enabled is defined inside menu.lua
|
||||
|
||||
print[[
|
||||
$('#network-clock').html(`${rsp.localtime}`);
|
||||
$('#network-uptime').html(`${rsp.uptime}`);
|
||||
|
||||
var msg = `
|
||||
<li class='nav-item p-btn mx-2'>
|
||||
<div class='d-flex'>`;
|
||||
let msg = `<li class='nav-item p-btn mx-2'><div class='d-flex'>`;
|
||||
|
||||
if(rsp.system_host_stats.cpu_states) {
|
||||
const iowait = ']] print(i18n("about.iowait")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.iowait) + "%";
|
||||
const active = ']] print(i18n("about.active")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.user + rsp.system_host_stats.cpu_states.system + rsp.system_host_stats.cpu_states.nice + rsp.system_host_stats.cpu_states.irq + rsp.system_host_stats.cpu_states.softirq + rsp.system_host_stats.cpu_states.guest + rsp.system_host_stats.cpu_states.guest_nice) + "%";
|
||||
const idle = ']] print(i18n("about.idle")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.idle + rsp.system_host_stats.cpu_states.steal) + "%";
|
||||
$('#cpu-states').html(iowait + " / " + active + " / " + idle);
|
||||
}
|
||||
if (rsp.system_host_stats.cpu_states && !system_view_enabled) {
|
||||
const iowait = ']] print(i18n("about.iowait")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.iowait) + "%";
|
||||
const active = ']] print(i18n("about.active")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.user + rsp.system_host_stats.cpu_states.system + rsp.system_host_stats.cpu_states.nice + rsp.system_host_stats.cpu_states.irq + rsp.system_host_stats.cpu_states.softirq + rsp.system_host_stats.cpu_states.guest + rsp.system_host_stats.cpu_states.guest_nice) + "%";
|
||||
const idle = ']] print(i18n("about.idle")) print[[: ' + formatValue(rsp.system_host_stats.cpu_states.idle + rsp.system_host_stats.cpu_states.steal) + "%";
|
||||
$('#cpu-states').html(iowait + " / " + active + " / " + idle);
|
||||
}
|
||||
|
||||
if (rsp.system_host_stats.mem_total !== undefined && !system_view_enabled) {
|
||||
|
||||
if (rsp.system_host_stats.mem_total !== undefined) {
|
||||
var mem_total = rsp.system_host_stats.mem_total;
|
||||
var mem_used = rsp.system_host_stats.mem_used;
|
||||
|
||||
var mem_used_ratio = mem_used / mem_total;
|
||||
|
||||
mem_used_ratio = mem_used_ratio * 100;
|
||||
mem_used_ratio = Math.round(mem_used_ratio * 100) / 100;
|
||||
mem_used_ratio = mem_used_ratio + "%";
|
||||
|
||||
$('#ram-used').html('Used: ' + mem_used_ratio + ' / Available: ' + bytesToSize((mem_total - mem_used) * 1024) + ' / Total: ' + bytesToSize(mem_total * 1024));
|
||||
$('#ram-process-used').html('Used: ' + bytesToSize(rsp.system_host_stats.mem_ntopng_resident * 1024));
|
||||
$('#dropped-alerts').html(rsp.system_host_stats.dropped_alerts ? fint(rsp.system_host_stats.dropped_alerts) : "0");
|
||||
|
|
@ -231,50 +222,35 @@ print[[
|
|||
$('#alerts-queries').html(rsp.system_host_stats.alerts_queries ? fint(rsp.system_host_stats.alerts_queries) : "0");
|
||||
}
|
||||
|
||||
if(rsp.system_host_stats.cpu_load !== undefined)
|
||||
$('#cpu-load-pct').html(ffloat(rsp.system_host_stats.cpu_load));
|
||||
if (rsp.system_host_stats.cpu_load !== undefined && !system_view_enabled) $('#cpu-load-pct').html(ffloat(rsp.system_host_stats.cpu_load));
|
||||
|
||||
if(rsp.degraded_performance) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/system_interfaces_stats.lua?page=internals&tab=periodic_activities&periodic_script_issue=any_issue\">"
|
||||
if (rsp.degraded_performance) {
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/system_interfaces_stats.lua?page=internals&tab=periodic_activities&periodic_script_issue=any_issue\">"
|
||||
msg += "<span class=\"badge badge-warning\"><i class=\"fas fa-exclamation-triangle\" title=\"]] print(i18n("internals.degraded_performance")) print[[\"></i></span></a>";
|
||||
}
|
||||
|
||||
if((rsp.engaged_alerts > 0 || rsp.alerted_flows > 0) && ]] print(ternary(hasAllowedNetworksSet(), "false", "true")) print[[) {
|
||||
var error_color = "#B94A48"; // bootstrap danger red
|
||||
if ((rsp.engaged_alerts > 0 || rsp.alerted_flows > 0) && ]] print(ternary(hasAllowedNetworksSet(), "false", "true")) print[[ && !system_view_enabled) {
|
||||
|
||||
var error_color = "#B94A48";
|
||||
var error_label = "badge-danger";
|
||||
var error_color = error_color;
|
||||
var color = error_color;
|
||||
var label = error_label;
|
||||
|
||||
if(rsp.engaged_alerts > 0) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/show_alerts.lua\">"
|
||||
|
||||
if (rsp.engaged_alerts > 0) {
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/show_alerts.lua\">"
|
||||
msg += "<span class=\"badge " + label + "\"><i class=\"fas fa-exclamation-triangle\"></i> "+addCommas(rsp.engaged_alerts)+"</span></a>";
|
||||
}
|
||||
|
||||
if(rsp.alerted_flows > 0) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/flows_stats.lua?flow_status=alerted\">"
|
||||
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/flows_stats.lua?flow_status=alerted\">"
|
||||
msg += "<span class=\"badge " + label + "\">"+addCommas(rsp.alerted_flows)+ " ]] print(i18n("flows")) print[[ <i class=\"fas fa-exclamation-triangle\"></i></span></a>";
|
||||
}
|
||||
|
||||
//Push.create('Hello World!');
|
||||
}
|
||||
|
||||
if((rsp.engaged_alerts > 0 || rsp.has_alerts > 0 || rsp.alerted_flows > 0) && $("#alerts-id").is(":visible") == false) {
|
||||
if ((rsp.engaged_alerts > 0 || rsp.has_alerts > 0 || rsp.alerted_flows > 0) && $("#alerts-id").is(":visible") == false && !system_view_enabled) {
|
||||
$("#alerts-id").show();
|
||||
}
|
||||
|
||||
if(rsp.ts_alerts && rsp.ts_alerts.influxdb) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/plugins/influxdb_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=alerts#tab-table-engaged-alerts\">"
|
||||
if (rsp.ts_alerts && rsp.ts_alerts.influxdb && !system_view_enabled) {
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/plugins/influxdb_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=alerts#tab-table-engaged-alerts\">"
|
||||
msg += "<span class=\"badge badge-danger\"><i class=\"fas fa-database\"></i></span></a>";
|
||||
}
|
||||
|
||||
|
|
@ -282,132 +258,133 @@ print [[/plugins/influxdb_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=a
|
|||
var alarm_threshold_high = 90; /* 90% */
|
||||
var alert = 0;
|
||||
|
||||
if(rsp.num_local_hosts > 0) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/hosts_stats.lua?mode=local\">";
|
||||
if (rsp.num_local_hosts > 0 && !system_view_enabled) {
|
||||
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/hosts_stats.lua?mode=local\">";
|
||||
msg += "<span title=\"]] print(i18n("local_hosts")) print[[\" class=\"badge badge-success\">";
|
||||
msg += addCommas(rsp.num_local_hosts)+" <i class=\"fas fa-laptop\" aria-hidden=\"true\"></i></span></a>";
|
||||
|
||||
checkMigrationMessage(rsp);
|
||||
}
|
||||
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/hosts_stats.lua?mode=remote\">";
|
||||
var remove_hosts_label = "]] print(i18n("remote_hosts")) print[[";
|
||||
if (!system_view_enabled) {
|
||||
|
||||
if(rsp.hosts_pctg < alarm_threshold_low) {
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-secondary\">";
|
||||
} else if(rsp.hosts_pctg < alarm_threshold_high) {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-warning\">";
|
||||
} else {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-danger\">";
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/hosts_stats.lua?mode=remote\">";
|
||||
var remove_hosts_label = "]] print(i18n("remote_hosts")) print[[";
|
||||
|
||||
if (rsp.hosts_pctg < alarm_threshold_low && !system_view_enabled) {
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-secondary\">";
|
||||
}
|
||||
else if (rsp.hosts_pctg < alarm_threshold_high && !system_view_enabled) {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-warning\">";
|
||||
}
|
||||
else {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + remove_hosts_label +"\" class=\"badge badge-danger\">";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_hosts-rsp.num_local_hosts)+" <i class=\"fas fa-laptop\" aria-hidden=\"true\"></i></span></a>";
|
||||
}
|
||||
|
||||
if (rsp.num_devices != undefined && !system_view_enabled) {
|
||||
|
||||
var macs_label = "]] print(i18n("mac_stats.layer_2_source_devices", {device_type=""})) print[[";
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/macs_stats.lua?devices_mode=source_macs_only\">";
|
||||
|
||||
if (rsp.macs_pctg < alarm_threshold_low) {
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-secondary\">";
|
||||
}
|
||||
else if(rsp.macs_pctg < alarm_threshold_high) {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-warning\">";
|
||||
}
|
||||
else {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-danger\">";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_devices)+" ]] print(i18n("devices")) print[[</span></a>";
|
||||
}
|
||||
|
||||
if (rsp.num_flows != undefined && !system_view_enabled) {
|
||||
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/flows_stats.lua\">";
|
||||
|
||||
if (rsp.flows_pctg < alarm_threshold_low) {
|
||||
msg += "<span class=\"badge badge-secondary\">";
|
||||
}
|
||||
else if(rsp.flows_pctg < alarm_threshold_high) {
|
||||
alert = 1;
|
||||
msg += "<span class=\"badge badge-warning\">";
|
||||
}
|
||||
else {
|
||||
alert = 1;
|
||||
msg += "<span class=\"badge badge-danger\">";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_flows)+" ]] print(i18n("flows")) print[[ </span> </a>";
|
||||
|
||||
if (rsp.flow_export_drops > 0) {
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/if_stats.lua\"><span class=\"badge badge-danger\"><i class=\"fas fa-exclamation-triangle\" style=\"color: #FFFFFF;\"></i> "+addCommas(rsp.flow_export_drops)+" Export drop";
|
||||
if(rsp.flow_export_drops > 1) msg += "s";
|
||||
msg += "</span></a>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((rsp.num_live_captures != undefined) && (rsp.num_live_captures > 0) && !system_view_enabled) {
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/live_capture_stats.lua\">";
|
||||
msg += "<span class=\"badge badge-primary\">";
|
||||
msg += addCommas(rsp.num_live_captures)+" <i class=\"fas fa-download fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if (rsp.remote_assistance != undefined && !system_view_enabled) {
|
||||
|
||||
var status = rsp.remote_assistance.status;
|
||||
var status_label = (status == "active") ? "success" : "danger";
|
||||
msg += "<a href=\"]] print(ntop.getHttpPrefix()) print[[/lua/admin/remote_assistance.lua?tab=status\"><span class=\"badge badge-" + status_label + "\" title=\"]] print(i18n("remote_assistance.remote_assistance")) print[[\">";
|
||||
msg += "<i class=\"fas fa-comment-dots fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if (rsp.traffic_recording != undefined && !system_view_enabled) {
|
||||
|
||||
var status_label="primary";
|
||||
var status_title="]] print(i18n("traffic_recording.recording")) print [[";
|
||||
|
||||
if (rsp.traffic_recording != "recording") {
|
||||
status_label = "danger";
|
||||
status_title = "]] print(i18n("traffic_recording.failure")) print [[";
|
||||
}
|
||||
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/if_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=traffic_recording&tab=status\">";
|
||||
msg += "<span class=\"badge badge-"+status_label+"\" title=\""+addCommas(status_title)+"\">";
|
||||
msg += "<i class=\"fas fa-hdd fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if (rsp.traffic_extraction != undefined && !system_view_enabled) {
|
||||
|
||||
var status_title="]] print(i18n("traffic_recording.traffic_extraction_jobs")) print [[";
|
||||
var status_label = "secondary";
|
||||
|
||||
if (rsp.traffic_extraction == "ready") status_label="primary";
|
||||
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/if_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=traffic_recording&tab=jobs\">";
|
||||
msg += "<span class=\"badge badge-"+status_label+"\" title=\""+addCommas(status_title)+"\">";
|
||||
msg += rsp.traffic_extraction_num_tasks+" <i class=\"fas fa-tasks fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_hosts-rsp.num_local_hosts)+" <i class=\"fas fa-laptop\" aria-hidden=\"true\"></i></span></a>";
|
||||
|
||||
if(typeof rsp.num_devices !== "undefined") {
|
||||
var macs_label = "]] print(i18n("mac_stats.layer_2_source_devices", {device_type=""})) print[[";
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/macs_stats.lua?devices_mode=source_macs_only\">";
|
||||
if(rsp.macs_pctg < alarm_threshold_low) {
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-secondary\">";
|
||||
} else if(rsp.macs_pctg < alarm_threshold_high) {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-warning\">";
|
||||
} else {
|
||||
alert = 1;
|
||||
msg += "<span title=\"" + macs_label +"\" class=\"badge badge-danger\">";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_devices)+" ]] print(i18n("devices")) print[[</span></a>";
|
||||
}
|
||||
|
||||
if(typeof rsp.num_flows !== "undefined") {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/flows_stats.lua\">";
|
||||
|
||||
if(rsp.flows_pctg < alarm_threshold_low) {
|
||||
msg += "<span class=\"badge badge-secondary\">";
|
||||
|
||||
} else if(rsp.flows_pctg < alarm_threshold_high) {
|
||||
alert = 1;
|
||||
msg += "<span class=\"badge badge-warning\">";
|
||||
} else {
|
||||
alert = 1;
|
||||
msg += "<span class=\"badge badge-danger\">";
|
||||
}
|
||||
|
||||
msg += addCommas(rsp.num_flows)+" ]] print(i18n("flows")) print[[ </span> </a>";
|
||||
if(rsp.flow_export_drops > 0) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/if_stats.lua\"><span class=\"badge badge-danger\"><i class=\"fas fa-exclamation-triangle\" style=\"color: #FFFFFF;\"></i> "+addCommas(rsp.flow_export_drops)+" Export drop";
|
||||
if(rsp.flow_export_drops > 1) msg += "s";
|
||||
|
||||
msg += "</span></a>";
|
||||
}
|
||||
}
|
||||
|
||||
if((typeof rsp.num_live_captures !== "undefined") && (rsp.num_live_captures > 0)) {
|
||||
msg += "<a href=\"]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/live_capture_stats.lua\">";
|
||||
msg += "<span class=\"badge badge-primary\">";
|
||||
msg += addCommas(rsp.num_live_captures)+" <i class=\"fas fa-download fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if(typeof rsp.remote_assistance !== "undefined") {
|
||||
var status = rsp.remote_assistance.status;
|
||||
var status_label = (status == "active") ? "success" : "danger";
|
||||
|
||||
msg += "<a href=\"]] print(ntop.getHttpPrefix()) print[[/lua/admin/remote_assistance.lua?tab=status\"><span class=\"badge badge-" + status_label + "\" title=\"]]
|
||||
print(i18n("remote_assistance.remote_assistance")) print[[\">";
|
||||
msg += "<i class=\"fas fa-comment-dots fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if(typeof rsp.traffic_recording !== "undefined") {
|
||||
var status_label="primary";
|
||||
var status_title="]] print(i18n("traffic_recording.recording")) print [[";
|
||||
if (rsp.traffic_recording != "recording") {
|
||||
status_label = "danger";
|
||||
status_title = "]] print(i18n("traffic_recording.failure")) print [[";
|
||||
}
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/if_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=traffic_recording&tab=status\">";
|
||||
msg += "<span class=\"badge badge-"+status_label+"\" title=\""+addCommas(status_title)+"\">";
|
||||
msg += "<i class=\"fas fa-hdd fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
if(typeof rsp.traffic_extraction !== "undefined") {
|
||||
var status_title="]] print(i18n("traffic_recording.traffic_extraction_jobs")) print [[";
|
||||
var status_label = "secondary";
|
||||
if (rsp.traffic_extraction == "ready") status_label="primary";
|
||||
msg += "<a href=\"]] print (ntop.getHttpPrefix()) print [[/lua/if_stats.lua?ifid=]] print(tostring(ifid)) print[[&page=traffic_recording&tab=jobs\">";
|
||||
msg += "<span class=\"badge badge-"+status_label+"\" title=\""+addCommas(status_title)+"\">";
|
||||
msg += rsp.traffic_extraction_num_tasks+" <i class=\"fas fa-tasks fa-lg\"></i></span></a>";
|
||||
}
|
||||
|
||||
|
||||
msg += '</div></li>';
|
||||
|
||||
$('#network-load').html(msg);
|
||||
|
||||
|
||||
if(alert) {
|
||||
$('#toomany').html("<div class='alert alert-warning'><h4>]] print(i18n("warning")) print[[</h4>]] print(i18n("about.you_have_too_many_flows", {product=info["product"]})) print[[.</div>");
|
||||
msg += '</div></li>';
|
||||
// append the message inside the network-load element
|
||||
$('#network-load').html(msg);
|
||||
|
||||
if (alert) {
|
||||
$('#toomany').html("<div class='alert alert-warning'><h4>]] print(i18n("warning")) print[[</h4>]] print(i18n("about.you_have_too_many_flows", {product=info["product"]})) print[[.</div>");
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
console.warn(e);
|
||||
/* alert("JSON Error (session expired?): logging out"); window.location.replace("]]
|
||||
print (ntop.getHttpPrefix())
|
||||
print [[/lua/logout.lua"); */
|
||||
/* alert("JSON Error (session expired?): logging out"); window.location.replace("]]print (ntop.getHttpPrefix())print [[/lua/logout.lua"); */
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ local is_nedge = ntop.isnEdge()
|
|||
local is_admin = isAdministrator()
|
||||
local info = ntop.getInfo()
|
||||
|
||||
local is_system_interface = ((ntop.getPref("ntopng.prefs.system_mode_enabled") == "1") and ntop.isAdministrator())
|
||||
-- this is a global variable
|
||||
local is_system_interface = ((ntop.getPref("ntopng.prefs.system_mode_enabled") == "1") and is_admin)
|
||||
|
||||
print([[
|
||||
<div id='wrapper'>
|
||||
|
|
@ -35,7 +36,7 @@ print[[
|
|||
"query_was_aborted": "]] print(i18n("graphs.query_was_aborted")) print[[",
|
||||
"exports": "]] print(i18n("system_stats.exports_label")) print[[",
|
||||
};
|
||||
|
||||
const system_view_enabled = ]] print(ternary(is_system_interface, "true", "false")) print[[;
|
||||
const http_prefix = "]] print(ntop.getHttpPrefix()) print[[";
|
||||
</script>]]
|
||||
|
||||
|
|
@ -808,11 +809,9 @@ end
|
|||
|
||||
-- ########################################
|
||||
-- Network Load
|
||||
if not is_system_interface then
|
||||
print([[
|
||||
<div id="network-load"></div>
|
||||
]])
|
||||
end
|
||||
|
||||
|
||||
-- ########################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue