Skip to content
Snippets Groups Projects
Commit 8b6b0cd7 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update check_apache_requests: more checks for response body

parent 7591e745
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
# script checks output of "/server-status" and counts scoreboard chars
# ----------------------------------------------------------------------
# 2020-04-09 v1.0 <axel.hahn@iml.unibe.ch>
# 2021-03-11 v1.1 <axel.hahn@iml.unibe.ch> more error checks for output data
# ======================================================================
. `dirname $0`/inc_pluginfunctions
......@@ -38,11 +39,10 @@ ph.require wget
# --- get /server-status page
wget --no-check-certificate -O $tmpfile $url 2>/dev/null
if [ $? -ne 0 ]; then
ph.abort "UNKNOWN: url $url did not respond a server status. `wget --no-check-certificate -O - -S $url`"
exit 1
rm -f $tmpfile
ph.abort "UNKNOWN: request to url $url failed. `wget --no-check-certificate -O - -S $url`"
fi
# set default / override from command line params
typeset -i iWarnLimit=` ph.getValueWithParam 75 w "$@"`
typeset -i iCriticalLimit=` ph.getValueWithParam 90 c "$@"`
......@@ -52,6 +52,11 @@ typeset -i iCriticalLimit=` ph.getValueWithParam 90 c "$@"`
iStart=` grep -n '<pre>' $tmpfile | cut -f 1 -d ':'`
iEnd=` grep -n '</pre>' $tmpfile | cut -f 1 -d ':'`
if [ $iStart -eq 0 -o $iEnd -eq 0 ]; then
rm -f $tmpfile
ph.abort "UNKNOWN: url $url has no PRE tag for apache scroreboard. I guess it is not a server-status page."
fi
sed -n "${iStart},${iEnd}p" $tmpfile | sed 's#<.*>##g' | tr -d "\n" >$tmpfile2
# <p>Scoreboard Key:<br />
......@@ -73,6 +78,11 @@ sed -n "${iStart},${iEnd}p" $tmpfile | sed 's#<.*>##g' | tr -d "\n" >$tmpfile2
# total slots available
iSlots=`cat $tmpfile2 | wc -m`
if [ $iSlots -eq 0 ]; then
rm -f $tmpfile $tmpfile2
ph.abort "UNKNOWN: url $url has no count of slots. I guess it is not a server-status page or option for Extended status is off."
fi
# running apache processes waiting for a request
iIdle=iCount=`sed -e "s/[^_]//g" $tmpfile2 | wc -m`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment