diff --git a/check_haproxy_health b/check_haproxy_health index 50db6bb388afcda6d596cbed771c0166e2615b9d..1d3d349a22cf3743def1e3c725bce603ef455b78 100755 --- a/check_haproxy_health +++ b/check_haproxy_health @@ -73,13 +73,15 @@ esac ph.require wget -cat $HAPROXYcfgfile >/dev/null -if [ $? -ne 0 ]; then +if [ ! -f $HAPROXYcfgfile ]; then + ph.abort "UNKNOWN: config file does not exist: $HAPROXYcfgfile" +fi + +if ! cat $HAPROXYcfgfile >/dev/null 2>&1; then ph.abort "UNKNOWN: unable to read ha proxy config $HAPROXYcfgfile ... $(ls -l $HAPROXYcfgfile)" fi -cat $HAPROXYcfgfile | grep " mode .*http" >/dev/null -if [ $? -ne 0 ]; then +if ! cat $HAPROXYcfgfile | grep " mode .*http" >/dev/null; then ph.abort "UNKNOWN: haproxy is not in http mode" fi