Werk #19251: PostgreSQL monitoring broken by util-linux 2.42
| Component | Checks & agents | ||||||||
| Title | PostgreSQL monitoring broken by util-linux 2.42 | ||||||||
| Date | Jun 23, 2026 | ||||||||
| Level | Trivial Change | ||||||||
| Class | Bug Fix | ||||||||
| Compatibility | Compatible - no manual interaction needed | ||||||||
| Checkmk versions & editions |
|
On some hosts running util-linux 2.42 or newer, all PostgreSQL services would
disappear from monitoring. Running the mk_postgres.py agent plugin manually
ended with an error such as:
ValueError: could not convert string to float: 'Letzte'
(the exact text depends on your system locale, e.g. "Letzte" in German or "Last" in English).
Technical background
The plugin runs psql as the database user and used to invoke it as
su - <user> -c <command>.
util-linux 2.42 changed su to no longer interpret options placed after the
target user name (its release notes note su: pass arguments after <user> to
shell, see
https://github.com/util-linux/util-linux/blob/master/Documentation/releases/v2.42-ReleaseNotes).
On builds that parse options this way, the -c <command> following <user>
was no longer treated as su's own option. su therefore acted as a plain login
with no command and printed its locale-dependent "last login" banner on
standard output; the -c <command> was then handed on to the login shell,
which still ran the query. Because the banner was printed ahead of the query
output, the plugin parsed the banner's first word (e.g. "Letzte") as the
PostgreSQL server version and aborted.
The plugin now passes the options ahead of the user name
(su --login -c <command> <user>), so su always interprets -c and suppresses the
banner. This works with both new and older versions of util-linux.
Note that not every util-linux 2.42 build is affected: only those whose su
stops interpreting options that come after the username. Builds that still
accept options in any position kept working, and the new argument order is
safe on them as well.