Added interface anomalies timeseries

This commit is contained in:
Matteo Biscosi 2021-03-29 19:35:30 +02:00
parent faa699328e
commit 53b27a023c
5 changed files with 73 additions and 15 deletions

View file

@ -489,6 +489,12 @@ schema:addMetric("anomaly")
-- ##############################################
schema = ts_utils.newSchema("iface:anomalies", {step=300, metrics_type=ts_utils.metrics.gauge})
schema:addTag("ifid")
schema:addMetric("anomalies")
-- ##############################################
schema = ts_utils.newSchema("host:l4protos", {step=300})
schema:addTag("ifid")
schema:addTag("host")

View file

@ -55,6 +55,19 @@ end
-- ########################################################
function ts_dump.iface_update_rrds(when, ifstats, verbose)
local anomalies_info = interface.getAnomalies()
anomalies_info = anomalies_info["anomalies"]
local anomalies_counter = (anomalies_info["tot_num_anomalies"]["local_hosts"] + anomalies_info["tot_num_anomalies"]["remote_hosts"]) - (anomalies_info["tot_num_old_anomalies"]["local_hosts"] + anomalies_info["tot_num_old_anomalies"]["remote_hosts"])
-- Save total anomalies delta counter
ts_utils.append("iface:anomalies", {ifid=ifstats.id, anomalies=anomalies_counter}, when)
end
-- ########################################################
function ts_dump.asn_update_rrds(when, ifstats, verbose)
local asn_info = interface.getASesInfo({detailsLevel = "higher"})
@ -633,6 +646,8 @@ function ts_dump.run_5min_dump(_ifname, ifstats, config, when)
end
end
ts_dump.iface_update_rrds(when, ifstats, verbose)
-- create RRD for ASN
if config.asn_rrd_creation == "1" then
ts_dump.asn_update_rrds(when, ifstats, verbose)