Added debug tracings

This commit is contained in:
Luca Deri 2021-03-12 16:41:13 +01:00
parent 7969be789e
commit c7c7e11d3d

View file

@ -358,12 +358,30 @@ function ts_dump.host_update_stats_rrds(when, hostname, host, ifstats, verbose)
-- Contacted Hosts Behaviour
if host["contacted_hosts_behaviour"] then
if(host.contacted_hosts_behaviour.value > 0) then
io.write(hostname.." [value: "..tostring(host.contacted_hosts_behaviour.value).."][prediction: "..tostring(host.contacted_hosts_behaviour.prediction).."][lower_bound: "..tostring(host.contacted_hosts_behaviour.lower_bound).."][upper_bound: "..tostring(host.contacted_hosts_behaviour.upper_bound).."]\n");
if(host.contacted_hosts_behaviour.hll_value > 0) then
local lower = host.contacted_hosts_behaviour.hw_lower_bound
local upper = host.contacted_hosts_behaviour.hw_upper_bound
local value = host.contacted_hosts_behaviour.hll_value
local prediction = host.contacted_hosts_behaviour.hw_prediction
local initialRun
if((lower == 0) and (upper == 0) and (prediction == 0)) then
prediction = true
else
prediction = false
end
if(not(initialRun) and ((value < lower) or (value > upper))) then
rsp = "ANOMALY"
else
rsp = "OK"
end
io.write(hostname.." [value: "..tostring(value).."][prediction: "..tostring(prediction).."][lower: "..tostring(lower).."][upper: "..tostring(upper).."]["..rsp.."]\n");
end
ts_utils.append("host:contacts_behaviour", {ifid=ifstats.id, host=hostname,
value=(host.contacted_hosts_behaviour.value or 0), prediction=(host.contacted_hosts_behaviour.prediction or 0)}, when)
value=(host.contacted_hosts_behaviour.hll_value or 0), prediction=(host.contacted_hosts_behaviour.hw_prediction or 0)}, when)
end