Werk #17458: Fix postgres plugin crash if no data is available

Component Checks & agents
Title Fix postgres plugin crash if no data is available
Date Aug 22, 2025
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.5.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.4.0p11 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

The postgres plugin collects data for services by running sql queries for it's sections. It can happen that a query does not yield a result, i.e. looking for long running queries. If no data was found on for a section our parser used to crash, generating a crash-report with the following error.

File "/omd/sites/display/lib/python3/cmk/checkengine/sectionparser.py", line 121, in _parse_raw_data
    return parse_function(list(raw_data))
  File "/omd/sites/display/lib/python3/cmk/plugins/lib/postgres.py", line 26, in parse_dbs
    headers = next(lines)[1:]    

If our parser crashes it can happen that we do not discovery the services corresponding to the agent sections. The parsing is been fixed now. If you have been affected new services may appear on host monitoring postgres.

To the list of all Werks