diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-02-20 23:45:13 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-02-20 23:45:13 +0100 |
commit | 3cd29d86cc51b763a0cf706e64884602cb3c9314 (patch) | |
tree | 593af7298d973a61e8f37309c9e0e2b1ce68b45e /lib | |
parent | f7f958eee739ae1a61859c834ec3531de384fe6f (diff) | |
download | monitoring-plugins-3cd29d86cc51b763a0cf706e64884602cb3c9314.tar.gz |
Remove output formats one-line and summary-only
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output.c | 43 | ||||
-rw-r--r-- | lib/output.h | 2 |
2 files changed, 0 insertions, 45 deletions
diff --git a/lib/output.c b/lib/output.c index 2c537a01..07a77165 100644 --- a/lib/output.c +++ b/lib/output.c | |||
@@ -235,35 +235,6 @@ char *mp_fmt_output(mp_check check) { | |||
235 | char *result = NULL; | 235 | char *result = NULL; |
236 | 236 | ||
237 | switch (check.format) { | 237 | switch (check.format) { |
238 | case MP_FORMAT_SUMMARY_ONLY: | ||
239 | if (check.summary == NULL) { | ||
240 | check.summary = get_subcheck_summary(check); | ||
241 | } | ||
242 | |||
243 | asprintf(&result, "%s: %s", state_text(mp_compute_check_state(check)), check.summary); | ||
244 | return result; | ||
245 | |||
246 | case MP_FORMAT_ONE_LINE: { | ||
247 | /* SERVICE STATUS: First line of output | First part of performance data | ||
248 | * Any number of subsequent lines of output, but note that buffers | ||
249 | * may have a limited size | Second part of performance data, which | ||
250 | * may have continuation lines, too | ||
251 | */ | ||
252 | if (check.summary == NULL) { | ||
253 | check.summary = get_subcheck_summary(check); | ||
254 | } | ||
255 | |||
256 | asprintf(&result, "%s: %s", state_text(mp_compute_check_state(check)), check.summary); | ||
257 | |||
258 | mp_subcheck_list *subchecks = check.subchecks; | ||
259 | |||
260 | while (subchecks != NULL) { | ||
261 | asprintf(&result, "%s - %s", result, fmt_subcheck_output(MP_FORMAT_ONE_LINE, subchecks->subcheck, 1)); | ||
262 | subchecks = subchecks->next; | ||
263 | } | ||
264 | |||
265 | return result; | ||
266 | } | ||
267 | case MP_FORMAT_ICINGA_WEB_2: { | 238 | case MP_FORMAT_ICINGA_WEB_2: { |
268 | if (check.summary == NULL) { | 239 | if (check.summary == NULL) { |
269 | check.summary = get_subcheck_summary(check); | 240 | check.summary = get_subcheck_summary(check); |
@@ -370,18 +341,6 @@ static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subch | |||
370 | subchecks = subchecks->next; | 341 | subchecks = subchecks->next; |
371 | } | 342 | } |
372 | return result; | 343 | return result; |
373 | case MP_FORMAT_ONE_LINE: | ||
374 | asprintf(&result, "[%s] - %s", state_text(mp_compute_subcheck_state(check)), check.output); | ||
375 | |||
376 | subchecks = check.subchecks; | ||
377 | |||
378 | while (subchecks != NULL) { | ||
379 | asprintf(&result, " - %s\n%s", result, fmt_subcheck_output(output_format, subchecks->subcheck, indentation + 1)); | ||
380 | subchecks = subchecks->next; | ||
381 | } | ||
382 | return result; | ||
383 | case MP_FORMAT_SUMMARY_ONLY: | ||
384 | return result; | ||
385 | default: | 344 | default: |
386 | die(STATE_UNKNOWN, "Invalid format"); | 345 | die(STATE_UNKNOWN, "Invalid format"); |
387 | } | 346 | } |
@@ -551,9 +510,7 @@ mp_subcheck mp_set_subcheck_default_state(mp_subcheck check, mp_state_enum state | |||
551 | } | 510 | } |
552 | 511 | ||
553 | char *mp_output_format_map[] = { | 512 | char *mp_output_format_map[] = { |
554 | [MP_FORMAT_ONE_LINE] = "one-line", | ||
555 | [MP_FORMAT_ICINGA_WEB_2] = "icingaweb2", | 513 | [MP_FORMAT_ICINGA_WEB_2] = "icingaweb2", |
556 | [MP_FORMAT_SUMMARY_ONLY] = "summary-only", | ||
557 | [MP_FORMAT_TEST_JSON] = "mp-test-json", | 514 | [MP_FORMAT_TEST_JSON] = "mp-test-json", |
558 | }; | 515 | }; |
559 | 516 | ||
diff --git a/lib/output.h b/lib/output.h index c7455d29..14c4bcf4 100644 --- a/lib/output.h +++ b/lib/output.h | |||
@@ -29,9 +29,7 @@ typedef struct subcheck_list { | |||
29 | * Possible output formats | 29 | * Possible output formats |
30 | */ | 30 | */ |
31 | typedef enum output_format { | 31 | typedef enum output_format { |
32 | MP_FORMAT_ONE_LINE, | ||
33 | MP_FORMAT_ICINGA_WEB_2, | 32 | MP_FORMAT_ICINGA_WEB_2, |
34 | MP_FORMAT_SUMMARY_ONLY, | ||
35 | MP_FORMAT_TEST_JSON, | 33 | MP_FORMAT_TEST_JSON, |
36 | } mp_output_format; | 34 | } mp_output_format; |
37 | 35 | ||