diff --git a/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.primary b/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.primary new file mode 100644 index 0000000..c57d2b3 --- /dev/null +++ b/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.primary @@ -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); +} diff --git a/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.secondary b/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.secondary new file mode 100644 index 0000000..a1f262f --- /dev/null +++ b/failover/local/usr/local/nagiosxi/html/includes/components/custom-includes/css/header.css.secondary @@ -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); +} diff --git a/pu-check-website b/pu-check-website index 166b846..e8d293f 100755 --- a/pu-check-website +++ b/pu-check-website @@ -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 - 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" +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 + 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