Updates to pu-check-website to mirror /usr/local/nagios/libexec/check_http

Backcopied /home/nagios/local/...css to here as well
2021
Eric Loyd 6 years ago
parent ad1306d80b
commit 26d0efdc44

@ -0,0 +1,8 @@
/* Primary CSS */
#header {
background: rgb(0,255,0);
background: -moz-linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
background: -webkit-linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
background: linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#00ff00",endColorstr="#000000",GradientType=1);
}

@ -0,0 +1,8 @@
/* Secondary CSS */
#header {
background: rgb(0,0,255);
background: -moz-linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
background: -webkit-linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
background: linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#0000ff",endColorstr="#000000",GradientType=1);
}

@ -3,27 +3,48 @@
# curl -c /tmp/cookie.txt --location -k "https://oampfsqual.princeton.edu:443/psp/pfsqual/EMPLOYEE/ERP/" | grep "Central Authentication Service"
http="http"
port="80"
host=""
uri=""
search=""
host=""
while [ -n "$1" ]; do
case "$1" in
-S) http="https"; shift 1;;
-H) host="$2"; shift 2;;
-u) uri="$2"; shift 2;;
-s) search="$2"; shift 2;;
*) shift 1;;
while getopts ":SH:u:s:p:" OPTION; do
case "$OPTION" in
S) http="https"; port=443;;
H) host="$OPTARG";;
u) uri="$OPTARG";;
s) search="$OPTARG";;
p) port="$OPTARG";;
esac
done
[ -z "$http" ] && echo "Error - invalid protocol ($http)" && exit 3
[ -z "$host" ] && echo "Error - invalid host ($host)" && exit 3
[ -z "$port" ] && echo "Error - invalid port ($port)" && exit 3
tmpfile="/tmp/cookies.txt.$$"
rm -Rf $tmpfile
curl --silent -c $tmpfile --location -k "$http://$host$uri" > $tmpfile.output
[ $? -ne 0 ] && echo "WARNING: $http://$host$uri did not respond properly" && exit 1
if [ -n "$search" ]; then
URL="$http://$host:$port$uri"
output_format="%{size_download} bytes in %{time_total} second response time |time=%{time_total}s;;;0.000 size=%{size_download}B;;;0"
output=`curl --silent -o $tmpfile.output -w "$output_format" -c $tmpfile --location -k "$URL"`
status=$?
if [ $status -eq 0 ]; then
if [ -n "$search" ]; then
grep -q "$search" $tmpfile.output
[ $? -ne 0 ] && echo "CRITICAL: Cannot find $search in $http://$host$uri" && exit 2
echo "OK: Found $search in $http://$host$uri"
status=$?
rm -Rf $tmpfile $tmpfile.*
if [ $status -ne 0 ]; then
echo "HTTP CRITICAL: string '$search' not found on '$URL' - $output"
exit 2
else
echo "HTTP OK: $output"
fi
else
echo "HTTP OK: $output"
fi
else
rm -Rf $tmpfile $tmpfile.*
echo "WARNING: $URL did not respond properly" && exit 1
fi
rm -Rf $tmpfile $tmpfile.*
exit 0

Loading…
Cancel
Save