mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Implements Netfilter queue monitoring
This commit is contained in:
parent
c382fd4631
commit
fd42cfd0cb
7 changed files with 81 additions and 48 deletions
|
|
@ -89,7 +89,7 @@ interface.select(ifname)
|
|||
local is_packetdump_enabled = isLocalPacketdumpEnabled()
|
||||
local is_packet_interface = interface.isPacketInterface()
|
||||
|
||||
ifstats = interface.getStats()
|
||||
local ifstats = interface.getStats()
|
||||
|
||||
-- this is a user-browseable page, so we must return counters from
|
||||
-- the latest reset as the user may have chosen to reset statistics at some point
|
||||
|
|
@ -612,6 +612,34 @@ print("</script>\n")
|
|||
print("</tr>\n")
|
||||
end
|
||||
|
||||
if ntop.isnEdge() and ifstats.type == "netfilter" and ifstats.netfilter then
|
||||
local st = ifstats.netfilter
|
||||
|
||||
print("<tr><th colspan=6 nowrap>"..i18n("if_stats_overview.nf").."</th></tr>\n")
|
||||
print("<tr><th nowrap>"..i18n("if_stats_overview.nf_queue_total").."</th>")
|
||||
print("<td width=20%><span id=nfq_queue_total>".. formatValue(st.queue_total) .."</span> <span id=nfq_queue_total_trend></span></td>")
|
||||
print("<th nowrap><i class='fa fa-tint' aria-hidden='true'></i> "..i18n("if_stats_overview.nf_queue_dropped").."</th>")
|
||||
print("<td width=20%><span id=nfq_queue_dropped>"..formatValue(st.queue_dropped).."</span> <span id=nfq_queue_dropped_trend></span></td>")
|
||||
|
||||
print("<th nowrap><i class='fa fa-tint' aria-hidden='true'></i> "..i18n("if_stats_overview.nf_queue_user_dropped").."</th>")
|
||||
print("<td width=20%><span id=nfq_queue_user_dropped>"..formatValue(st.user_dropped).."</span> <span id=nfq_queue_user_dropped_trend></span></td>")
|
||||
|
||||
print("</tr>")
|
||||
|
||||
print("<tr><th nowrap>"..i18n("if_stats_overview.nf_queue_pct").."</th>")
|
||||
local span_class = ''
|
||||
if st.queue_pct > 80 then
|
||||
span_class = "class='label label-danger'"
|
||||
end
|
||||
print("<td width=20%><span id=nfq_queue_pct "..span_class..">"..formatValue(st.queue_pct).." %</span> <span id=nfq_queue_pct_trend></span></td>")
|
||||
print("<th nowrap>"..i18n("if_stats_overview.nf_handle_packet_failed").."</th>")
|
||||
print("<td width=20%><span id=nfq_handling_failed>"..formatValue(st.failures.handle_packet).."</span> <span id=nfq_handling_failed_trend></span></td>")
|
||||
print("<th nowrap>"..i18n("if_stats_overview.nf_enobufs").."</th>")
|
||||
print("<td width=20%><span id=nfq_enobufs>"..formatValue(st.failures.no_buffers).."</span> <span id=nfq_enobufs_trend></span></td>")
|
||||
|
||||
print("</tr>")
|
||||
end
|
||||
|
||||
if((ifstats["bridge.device_a"] ~= nil) and (ifstats["bridge.device_b"] ~= nil)) then
|
||||
print("<tr><th colspan=7>"..i18n("if_stats_overview.bridged_traffic").."</th></tr>\n")
|
||||
print("<tr><th nowrap>"..i18n("interface").."</th><th nowrap>"..i18n("if_stats_overview.ingress_packets").."</th><th nowrap>"..i18n("if_stats_overview.egress_packets").."</th><th nowrap>"..i18n("if_stats_overview.shaped_filtered_packets").."</th><th nowrap>"..i18n("if_stats_overview.send_error").."</th><th nowrap>"..i18n("if_stats_overview.buffer_full").."</th></tr>\n")
|
||||
|
|
@ -2414,6 +2442,39 @@ print [[/lua/network_load.lua',
|
|||
$('#if_pkts').html(addCommas(rsp.packets)+"]]
|
||||
|
||||
print(" Pkts\");")
|
||||
|
||||
if ntop.isnEdge() and ifstats.type == "netfilter" and ifstats.netfilter then
|
||||
local st = ifstats.netfilter
|
||||
|
||||
print("var last_nfq_time = 0;\n")
|
||||
print("var last_nfq_queue_total = ".. st.queue_total .. ";\n")
|
||||
print("var last_nfq_queue_dropped = ".. st.queue_dropped .. ";\n")
|
||||
print("var last_nfq_queue_user_dropped = ".. st.user_dropped .. ";\n")
|
||||
print("var last_nfq_queue_pct = ".. st.queue_pct.. ";\n")
|
||||
print("var last_nfq_handling_failed = ".. st.failures.handle_packet .. ";\n")
|
||||
print("var last_nfq_enobufs = ".. st.failures.no_buffers .. ";\n")
|
||||
|
||||
print[[
|
||||
$('#nfq_queue_total').html(fint(rsp.netfilter.queue_total));
|
||||
$('#nfq_queue_total_trend').html(get_trend(last_nfq_queue_total, rsp.netfilter.queue_total));
|
||||
$('#nfq_queue_dropped').html(fint(rsp.netfilter.queue_dropped));
|
||||
$('#nfq_queue_dropped_trend').html(get_trend(last_nfq_queue_dropped, rsp.netfilter.queue_dropped));
|
||||
$('#nfq_queue_user_dropped').html(fint(rsp.netfilter.user_dropped));
|
||||
$('#nfq_queue_user_dropped_trend').html(get_trend(last_nfq_queue_user_dropped, rsp.netfilter.user_dropped));
|
||||
if(rsp.netfilter.queue_pct > 80) {
|
||||
$('#nfq_queue_pct').addClass("label label-danger");
|
||||
} else {
|
||||
$('#nfq_queue_pct').removeClass("label label-danger");
|
||||
}
|
||||
$('#nfq_queue_pct').html(fint(rsp.netfilter.queue_pct) + " %");
|
||||
$('#nfq_queue_pct_trend').html(get_trend(last_nfq_queue_pct, rsp.netfilter.queue_pct));
|
||||
$('#nfq_handling_failed').html(fint(rsp.netfilter.failures.handle_packet));
|
||||
$('#nfq_handling_failed_trend').html(get_trend(last_nfq_handling_failed, rsp.netfilter.failures.handle_packet));
|
||||
$('#nfq_enobufs').html(fint(rsp.netfilter.failures.no_buffers));
|
||||
$('#nfq_enobufs_trend').html(get_trend(last_nfq_enobufs, rsp.netfilter.failures.no_buffers));
|
||||
]]
|
||||
end
|
||||
|
||||
print [[
|
||||
var pctg = 0;
|
||||
var drops = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue