From c565c1f36b079fa1aa2ff1bd2b0de08005ca5cb8 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Fri, 8 Jul 2022 11:07:21 +0200
Subject: [PATCH] fix messed data instead abort

---
 icinga-cli.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/icinga-cli.sh b/icinga-cli.sh
index d1f9e13..5205109 100755
--- a/icinga-cli.sh
+++ b/icinga-cli.sh
@@ -362,9 +362,10 @@ function processCheck(){
       iPipes=$( sed 's#[^|]##g' "$_outfile" | grep "." | wc -L )
       _echo "Pipe chars: $iPipes"
       if [[ $iPipes -gt 1 ]]; then
-        _elog "ABORT - pipes were found in plugin output"
+        _elog "WARNING - pipes were found in plugin output"
         _elog "command was: $myFullscript $myparams"
-        exit 1
+        _log "${_logPrefix} WARNING - pipes were found in plugin output"
+        sed -i "s#|#:#g" "$_outfile"
       fi
 
       _echo
@@ -372,9 +373,10 @@ function processCheck(){
       # echo $outPerfdata
       # echo
       if ! test -n "$outPerfdata" && echo "$outPerfdata" | grep "=[0-9\.]*;[0-9\.]*;[0-9\.]*;[0-9\.]*;" >/dev/null; then
-        _elog "ABORT - this does not look like performance data: $outPerfdata"
+        _elog "WARNING - this does not look like performance data: $outPerfdata"
         _elog "command was: $myFullscript $myparams"
-        exit 1
+        _log "${_logPrefix} this does not look like performance data: $outPerfdata"
+        outPerfdata=""
       fi
       _log "${_logPrefix} check command finished with returncode $rc"
 
-- 
GitLab