Handle missing graylog_input_metrics entries better.

This commit is contained in:
Marsell Kukuljevic 2026-02-08 16:44:15 +01:00
parent 387b103dcc
commit 01c2b9c428
3 changed files with 7 additions and 5 deletions

Binary file not shown.

View File

@ -36,10 +36,11 @@ def inventory_graylog_input_metrics(parsed):
def check_graylog_input_metrics(item, params, parsed):
# if parsed is None: return
item_id = item.split()[-1][1:-1]
input_info = parsed[item_id]
input_info = parsed.get(item_id)
if not input_info:
return
input_state = input_info["input_state"]
state = 1
@ -60,11 +61,12 @@ def check_graylog_input_metrics(item, params, parsed):
("rs_m5_rate", "rs_m5_rate", "/5min", get_bytes_human_readable, ""),
("rs_m15_rate", "rs_m15_rate", "/15min", get_bytes_human_readable, ""),
]:
value = parsed[item_id][key]
value = input_info[key]
value = round(value, 2)
rate_upper = params.get(key, {}).get("%s_upper" % key, (None, None))
rate_lower = params.get(key, {}).get("%s_lower" % key, (None, None))
yield check_levels(
value,
dsname,