Hello,
perhaps something where nobody would ever stumble over…
I’m querying livestatus for the following fields against the statehist table:
duration_part_critical
duration_part_ok
duration_part_unknown
duration_part_unmonitored
duration_part_warning
When the resulting line is for the availability of a host (=service_description is empty) the field “duration_part_warning” is filled instead of “duration_part_critical” for “DOWN”.
Version is 2.3.0p22, but other versions report the value in the same field. When I move the field in my query the values moves to apropriate position in output.
Example:
def _availability_query(self, start, end) -> str:
return "\n".join(
[
"GET statehist",
"Columns: host_name service_description",
f"Filter: time >= {int(start.timestamp())}",
f"Filter: time < {int(end.timestamp())}",
"Stats: sum duration_part_ok",
"Stats: sum duration_part_critical",
"Stats: sum duration_part_unknown",
"Stats: sum duration_part_warning",
"Stats: sum duration_part_unmonitored",
]
)
Results in:
columns: host_name, service_description, ok, crit, unkn, warn, unmon
row: ['SW09', '', 0.9986, 0, 0, 0.00139969, 0]
I suspect a wrong assignment to the calculated stats, because hosts have [0 (UP),1 (DOWN) ,2 (UNKN/UNREACH)] instead of [0 (OK),1 (WARN) ,2 (CRIT), 3 (UNKN)] as states.