Werk #23130 · Nov 17, 26
Plug-in API: report unparsable values with ParseFailure
Check plug-ins written against cmk.agent_based.v3_unstable can now
report a value they could not parse without failing for the whole
section.
A parse function can put a ParseFailure into the parsed section in
place of a value or a row it could not convert. The new helper
parse_as does this for you: it converts a value with any callable,
for example int, an enum or a function that parses a whole row, and
returns a ParseFailure if that raises a ValueError, TypeError or
LookupError.
A check function yields the failure like any other result. The service
then shows the UNKNOWN result Could not parse '<field>': <error> next
to its other results, and Checkmk creates a crash report whose ID is
shown in the service details. The other values and services of the
section are not affected. In a cluster, the failure counts as an
UNKNOWN result of the node that sent the data.
cmk.agent_based.v3_unstable is not a stable API yet and may still
change. The docstring of ParseFailure explains what a plug-in has to
do to use it.
Details
- Class:
- New Features
- Level:
- Trivial
- Component:
- Checks
- Versions:
- 3.0.0b1Not yet releasedAll Editions