Fixes host anomalies wrongly triggered

This commit is contained in:
Matteo Biscosi 2021-03-15 19:56:10 +01:00
parent 4cb53e4508
commit 1466e466d7
2 changed files with 17 additions and 2 deletions

View file

@ -376,8 +376,10 @@ function ts_dump.host_update_stats_rrds(when, hostname, host, ifstats, verbose)
else
rsp = "OK"
end
io.write(hostname.." [value: "..tostring(value).."][prediction: "..tostring(prediction).."][lower: "..tostring(lower).."][upper: "..tostring(upper).."]["..rsp.."]\n");
if enable_debug then
io.write(hostname.."\n\t\t[Contacts Behaviour]\n\t\t[value: "..tostring(value).."][prediction: "..tostring(prediction).."][lower: "..tostring(lower).."][upper: "..tostring(upper).."]["..rsp.."]\n");
end
end
ts_utils.append("host:contacts_behaviour", {ifid=ifstats.id, host=hostname,
@ -388,6 +390,11 @@ function ts_dump.host_update_stats_rrds(when, hostname, host, ifstats, verbose)
if host["score_behaviour"] then
local h = host["score_behaviour"]
if enable_debug then
io.write(hostname.."\n\t\t[Score Behaviour]\n\t\t\t[Client][value: "..tostring(h["as_client.value"]).."][prediction: "..tostring(h["as_client.prediction"]).."][lower: "..tostring(h["as_client.lower_bound"]).."][upper: "..tostring(h["as_client.upper_bound"]).."][ANOMALY:"..tostring(h["as_client.anomaly"]).."]\n");
io.write("\t\t\t[Server][value: "..tostring(h["as_server.value"]).."][prediction: "..tostring(h["as_server.prediction"]).."][lower: "..tostring(h["as_server.lower_bound"]).."][upper: "..tostring(h["as_server.upper_bound"]).."][ANOMALY: "..tostring(h["as_client.anomaly"]).."]\n");
end
-- Score Behaviour
--tprint(h)
ts_utils.append("host:cli_score_behaviour", {ifid=ifstats.id, host=hostname,
@ -417,6 +424,11 @@ function ts_dump.host_update_stats_rrds(when, hostname, host, ifstats, verbose)
if host["active_flows_behaviour"] then
local h = host["active_flows_behaviour"]
if enable_debug then
io.write("\n\t\t[Active Flows Behaviour]\n\t\t\t[Client][value: "..tostring(h["as_client.value"]).."][prediction: "..tostring(h["as_client.prediction"]).."][lower: "..tostring(h["as_client.lower_bound"]).."][upper: "..tostring(h["as_client.upper_bound"]).."][ANOMALY:"..tostring(h["as_client.anomaly"]).."]\n");
io.write("\t\t\t[Server][value: "..tostring(h["as_server.value"]).."][prediction: "..tostring(h["as_server.prediction"]).."][lower: "..tostring(h["as_server.lower_bound"]).."][upper: "..tostring(h["as_server.upper_bound"]).."][ANOMALY: "..tostring(h["as_client.anomaly"]).."]\n");
end
--tprint(h)
ts_utils.append("host:cli_active_flows_behaviour", {ifid=ifstats.id, host=hostname,
value=h["as_client.value"], lower_bound=h["as_client.lower_bound"], upper_bound = h["as_client.upper_bound"]}, when)