From 259a9de96c2c0a6888f400168a7fd02da8f6f77e Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 28 Jul 2023 10:18:36 +0200
Subject: [PATCH] update help text; replace $cfgfile

---
 check_haproxy_health | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/check_haproxy_health b/check_haproxy_health
index 3b7640d..50db6bb 100755
--- a/check_haproxy_health
+++ b/check_haproxy_health
@@ -21,7 +21,7 @@ export self_APPVERSION=1.6
 
 . $(dirname $0)/inc_haproxy_cfg.sh
 
-cfgfile=/etc/haproxy/haproxy.cfg
+
 tmpfile=/tmp/check_haproxy_healthcheck_$$
 
 # ----------------------------------------------------------------------
@@ -34,7 +34,15 @@ cat <<EOF
 $( ph.showImlHelpHeader )
 
 Check HA Proxy health.
-The plugin reads $cfgfile to detect required status url. 
+The plugin reads $HAPROXYcfgfile to detect required status url. 
+It requires wget to handle the http request.
+
+Non OK values occur:
+  UNKNOWN - if $HAPROXYcfgfile cannot be read
+          - haproxy is not in http mode
+          - the detected status url doesn't send a response
+  ERROR - the detected status url did not respond with Http status 
+          code 200
 
 SYNTAX:
 $_self [-h]
@@ -65,12 +73,12 @@ esac
 
 ph.require wget
 
-cat $cfgfile >/dev/null
+cat $HAPROXYcfgfile >/dev/null
 if [ $? -ne 0 ]; then
-  ph.abort "UNKNOWN: unable to read ha proxy config $cfgfile ... $(ls -l $cfgfile)"
+  ph.abort "UNKNOWN: unable to read ha proxy config $HAPROXYcfgfile ... $(ls -l $HAPROXYcfgfile)"
 fi
 
-cat $cfgfile | grep " mode .*http" >/dev/null
+cat $HAPROXYcfgfile | grep " mode .*http" >/dev/null
 if [ $? -ne 0 ]; then
   ph.abort "UNKNOWN: haproxy is not in http mode"
 fi
-- 
GitLab