Module: monitoring-plugins
Branch: master
Commit: 2d4f98f50b3470852aea99c61c64cfc11405a8fc
Author: Lorenz Kästle <[email protected]>
Committer: GitHub <[email protected]>
Date: Mon Mar 16 12:28:25 2026 +0100
URL:
https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=2d4f98f5
Remove troublesome symbols from output (#2240)
Co-authored-by: Lorenz Kästle <[email protected]>
---
lib/output.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/output.c b/lib/output.c
index d1a8d3b9..bfd43195 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -259,6 +259,21 @@ mp_state_enum mp_eval_check_default(const mp_check check) {
return result;
}
+// Remove troublesome symbols from plugin output
+char *sanitize_output_insitu(char *input) {
+ if (input == NULL) {
+ return input;
+ }
+
+ for (char *walker = input; *walker != '\0'; walker++) {
+ if (*walker == '|') {
+ *walker = ' ';
+ }
+ }
+
+ return input;
+}
+
/*
* Generate output string for a mp_check object
* Non static to be available for testing functions
@@ -299,6 +314,8 @@ char *mp_fmt_output(mp_check check) {
subchecks = subchecks->next;
}
+ result = sanitize_output_insitu(result);
+
if (pd_string != NULL && strlen(pd_string) > 0) {
asprintf(&result, "%s|%s", result, pd_string);
}