fix crash of check postgres_stats when relname contains semicolon
Hi,
we have a postgres database where the value of the relname column (table pg_class) contains a semicolon. Since the delimiter of the postgres_stats check is also a semicolon the check can not parse the result correctly and will crash in checkmk.
The Agent Output will be the following (note the two semicolons behind ms_ys, it should be only one):
dbtest;ms_ys;;way_schema_history;-1;-1
Exception: ValueError (invalid literal for int() with base 10: 'way_schema_history')
Traceback (version 2.0.0p33):
File "/omd/sites/prod_slave3/lib/python3/cmk/base/checking.py", line 564, in get_aggregated_result
result = _aggregate_results(check_function(**kwargs))
File "/omd/sites/prod_slave3/lib/python3/cmk/base/checking.py", line 796, in _aggregate_results
perfdata, results = _consume_and_dispatch_result_types(subresults)
File "/omd/sites/prod_slave3/lib/python3/cmk/base/checking.py", line 840, in _consume_and_dispatch_result_types
for subr in subresults:
File "/omd/sites/prod_slave3/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator
for element in generator(*args, **kwargs):
File "/omd/sites/prod_slave3/lib/python3/cmk/base/api/agent_based/register/check_plugins_legacy.py", line 183, in check_result_generator
for subresult in subresults:
File "/omd/sites/prod_slave3/share/check_mk/checks/postgres_stats", line 88, in check_postgres_stats
last_time = int(value)
This fix will ensure that semicolons in the values of nspname/relname will be removed so that we don't have any issues with the delimiter of the check
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.