scripts/lua/modules: always show "Other" talker

This commit lets the "Other" talker be always shown in the top talkers
report of a web interface if its traffic value is not zero. This also
lets the "Other" talker accumulate traffic also for hosts above the
maximum number of top talkers.
This commit is contained in:
Arianna Avanzini 2015-07-30 21:58:12 +02:00
parent 42fe686df8
commit 6633f21bdd
2 changed files with 8 additions and 2 deletions

View file

@ -704,14 +704,18 @@ print[[
if (nonempty != 0)
infoHTML += "<li>"+capitaliseFirstLetter(i)+" [Avg Traffic/sec]<ol>";
var items = 0;
var other_traffic = 0;
$.each(n, function(j, m) {
if(items < 3) {
infoHTML += "<li><a href=']]
print(scriptname.."?"..key.."=")
print[["+m.address+"'>"+m.label; if ("]]print(sectionname)print[[".toLowerCase() == "Operating Systems") infoHTML += getOSIcon(m.label); if ("]]print(sectionname)print[[".toLowerCase() == "countries") infoHTML += " <img src=']] print(ntop.getHttpPrefix()) print [[/img/blank.gif' class='flag flag-"+m.label.toLowerCase()+"'>"; infoHTML += "</a>"; if (m.vlan != "0") infoHTML += " ("+m.vlanm+")"; infoHTML += " ("+]] print(formatter_fctn) print [[((m.value*8)/seconds)+")</li>";
items++;
}
} else
other_traffic += m.value;
});
if (other_traffic > 0)
infoHTML += "<li>Other ("+]]print(formatter_fctn)print[[((other_traffic*8)/seconds)+")</li>";
if (nonempty != 0)
infoHTML += "</ol></li>";
});