Implement ICMP and HTTP requests vs replies ratio alert

This commit is contained in:
emanuele-f 2019-08-27 10:33:08 +02:00
parent 5dd88985f4
commit 57e623da04
3 changed files with 31 additions and 13 deletions

View file

@ -20,6 +20,21 @@ local function request_reply_ratio(params)
to_check["dns_rcvd"] = {info["dns"]["rcvd"]["num_queries"], (info["dns"]["sent"]["num_replies_ok"] + info["dns"]["sent"]["num_replies_error"])}
end
if(info["http"] ~= nil) then
to_check["http_sent"] = {info["http"]["sender"]["query"]["total"], info["http"]["receiver"]["response"]["total"]}
to_check["http_rcvd"] = {info["http"]["receiver"]["query"]["total"], info["http"]["sender"]["response"]["total"]}
end
if(info["ICMPv4"] ~= nil) then
local reqs = info["ICMPv4"]["8,0"]
local repl = info["ICMPv4"]["0,0"]
if((reqs ~= nil) and (repl ~= nil)) then
to_check["icmp_echo_sent"] = {reqs["sent"], repl["rcvd"]}
to_check["icmp_echo_rcvd"] = {reqs["rcvd"], repl["sent"]}
end
end
for key, values in pairs(to_check) do
local to_check_key = check_module.key .. "__" .. key
local requests = alerts_api.host_delta_val(to_check_key .. "_requests", params.granularity, values[1])
@ -44,11 +59,6 @@ check_module = {
--~ default_value = "request_reply_ratio;lt;15", -- 15%
local_only = true,
granularity = {
-- executed only in the minute-by-minute check
"min"
},
gui = {
i18n_title = "entity_thresholds.request_reply_ratio_title",
i18n_description = "entity_thresholds.request_reply_ratio_description",