diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-04-06 12:17:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-06 12:17:43 +0200 |
| commit | 9980e788509af3203725cdcd15f517ad1ed503fb (patch) | |
| tree | 51c65dfd829e56bab4ce8c942e958d04d332833f /lib | |
| parent | c57381d789fb246602966fccfcb80131a7fb0461 (diff) | |
| download | monitoring-plugins-9980e788509af3203725cdcd15f517ad1ed503fb.tar.gz | |
The new output functionality was discussed in the context of
check_by_ssh, where it mostly adds more stuff which was seen as
not inherently usefull as a succesful check_by_ssh check
might as well be transparent.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/output.c | 7 | ||||
| -rw-r--r-- | lib/output.h | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/output.c b/lib/output.c index bfd43195..54d505d9 100644 --- a/lib/output.c +++ b/lib/output.c | |||
| @@ -61,6 +61,8 @@ static inline char *fmt_subcheck_perfdata(mp_subcheck check) { | |||
| 61 | mp_check mp_check_init(void) { | 61 | mp_check mp_check_init(void) { |
| 62 | mp_check check = { | 62 | mp_check check = { |
| 63 | .evaluation_function = &mp_eval_check_default, | 63 | .evaluation_function = &mp_eval_check_default, |
| 64 | .default_output_override = NULL, | ||
| 65 | .default_output_override_content = NULL, | ||
| 64 | }; | 66 | }; |
| 65 | return check; | 67 | return check; |
| 66 | } | 68 | } |
| @@ -283,6 +285,11 @@ char *mp_fmt_output(mp_check check) { | |||
| 283 | 285 | ||
| 284 | switch (output_format) { | 286 | switch (output_format) { |
| 285 | case MP_FORMAT_MULTI_LINE: { | 287 | case MP_FORMAT_MULTI_LINE: { |
| 288 | if (check.default_output_override != NULL) { | ||
| 289 | result = check.default_output_override(check.default_output_override_content); | ||
| 290 | break; | ||
| 291 | } | ||
| 292 | |||
| 286 | if (check.summary == NULL) { | 293 | if (check.summary == NULL) { |
| 287 | check.summary = get_subcheck_summary(check); | 294 | check.summary = get_subcheck_summary(check); |
| 288 | } | 295 | } |
diff --git a/lib/output.h b/lib/output.h index c63c8e3f..f5011268 100644 --- a/lib/output.h +++ b/lib/output.h | |||
| @@ -70,6 +70,10 @@ struct mp_check { | |||
| 70 | 70 | ||
| 71 | // the evaluation_functions computes the state of check | 71 | // the evaluation_functions computes the state of check |
| 72 | mp_state_enum (*evaluation_function)(mp_check); | 72 | mp_state_enum (*evaluation_function)(mp_check); |
| 73 | |||
| 74 | // override for the default output format | ||
| 75 | char *(*default_output_override)(void *); | ||
| 76 | void *default_output_override_content; | ||
| 73 | }; | 77 | }; |
| 74 | 78 | ||
| 75 | mp_check mp_check_init(void); | 79 | mp_check mp_check_init(void); |
