| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
host=`hostname`
host="www$host"
ret=`timeout 5 curl --insecure -so /dev/null -w 'time_total: %{time_total}\ncode: %{http_code}\n' https://$host/speedtest/`
if [ $? -ne 0 ]; then
echo "$host/speedtest/ timed out - I gave up after 5 seconds."
exit 2
fi
time=`echo $ret | grep time_total | awk '{print $2}'`
code=`echo $ret | grep code | awk '{print $4}'`
timems=`echo $time'*1000' | bc | cut -d. -f1`
customerview_count_file=/tmp/customerview_count
if [[ $code -ne 200 ]]; then
echo "$host/speedtest/ didn't receive a 200, we received $code"
exit 2
fi
if [ ! -e "${customerview_count_file}" ]; then
echo 0 >"${customerview_count_file}"
fi
COUNT=$(cat "${customerview_count_file}")
if [[ $timems -gt 1500 ]]; then
if [[ $COUNT -gt 0 ]]; then
echo "$host/speedtest/ took $timems ms to load"
exit 2
fi
COUNT=$(($COUNT+1))
echo $COUNT >"${customerview_count_file}"
elif [[ $timems -gt 800 ]]; then
if [[ $COUNT -gt 0 ]]; then
echo "$host/speedtest/ took $timems ms to load"
exit 1
fi
COUNT=$(($COUNT+1))
echo $COUNT >"${customerview_count_file}"
else
echo 0 >"${customerview_count_file}"
fi
echo "$host/speedtest/ took $timems ms to load"
exit 0