Splitted metric in host:ndpi_categories schema

This commit is contained in:
SalvatoreCostantino 2019-05-07 23:06:31 +02:00
parent b054577387
commit 3fe3fecabf
4 changed files with 17 additions and 4 deletions

View file

@ -306,9 +306,13 @@ end
function ts_dump.host_update_categories_rrds(when, hostname, host, ifstats, verbose)
-- nDPI Protocol CATEGORIES
for k, bytes in pairs(host["ndpi_categories"] or {}) do
for k, value in pairs(host["ndpi_categories"] or {}) do
local sep = string.find(value, "|")
local bytes_sent = string.sub(value, 1, sep-1)
local bytes_rcvd = string.sub(value, sep+1)
ts_utils.append("host:ndpi_categories", {ifid=ifstats.id, host=hostname, category=k,
bytes=bytes}, when, verbose)
bytes_sent=bytes_sent, bytes_rcvd=bytes_rcvd}, when, verbose)
end
end