From 52cf4466b53f19a7feff53b75316538554684a8a Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 14 Mar 2022 14:00:42 +0100
Subject: [PATCH] icingacli - remove http statuscode

---
 icinga-cli.sh    | 12 ++++++++----
 inc_functions.sh |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/icinga-cli.sh b/icinga-cli.sh
index c79648e..35cb006 100755
--- a/icinga-cli.sh
+++ b/icinga-cli.sh
@@ -401,7 +401,7 @@ function processCheck(){
       # --- check if data were sent successfully
       # fgrep "HTTP/1.1 200" ${_response} >/dev/null
       # _testHttpOk ${_response} >/dev/null
-      http.isOk 2>/dev/null
+      http.isOk >/dev/null
       if [ $? -eq 0 ]; then
         _log "${_logPrefix} OK, response was sent to Icinga"
       else
@@ -410,6 +410,7 @@ function processCheck(){
         _echo
         _echo For Debugging:
         _echo "$( $ch --show --json )"
+        _log "$( $ch --show --json )"
       fi
       $ch --flush 2>/dev/null
 
@@ -517,8 +518,9 @@ function showVersion(){
 #
 # ----------------------------------------------------------------------
 
+. "$( dirname $0 )/inc_functions.sh"
 
-cat <<EOBANNER
+_echo "
 ______________________________________________________________________________________
 
  _______        __
@@ -536,8 +538,10 @@ ________________________________________________________________________________
 
 ______________________________________________________________________________________
 
+"
+
+_log "Starting $_product $_version"
 
-EOBANNER
 
 if [ "$1" = "--cfg" ] && [ -n "$2" ]; then
   echo "INFO: loading custom config [$2]..."
@@ -546,7 +550,7 @@ if [ "$1" = "--cfg" ] && [ -n "$2" ]; then
 else
   . "$( dirname $0 )/inc_getconfig.sh"
 fi
-. "$( dirname $0 )/inc_functions.sh"
+
 . "$( dirname $0 )/inc/rest-api-client.sh"
 
 if [ $# -eq 0 ]; then
diff --git a/inc_functions.sh b/inc_functions.sh
index 8d3cee5..c7495a2 100644
--- a/inc_functions.sh
+++ b/inc_functions.sh
@@ -52,7 +52,7 @@
   # echo if there is an interactive shell
   # params  string(s)  message to log
   function _echo(){
-    test $isInteractiveShell && echo $*
+    test $isInteractiveShell && echo "$*"
   }
 
 # ======================================================================
-- 
GitLab