User Tools

Site Tools


linux:sendstatus

Run every 10minutes

#export http_proxy=http://10.160.150.250:8080
while [ 1 ]
do
url="http://janforman.com/"
name="router.janforman.com"
cores="`cat /proc/cpuinfo | grep -i bogomips | wc -l`"
total="`free | awk 'NR==2 {print $2}'`"
used="`free | awk 'NR==2 {print $3}'`"
totalstorage="`df / -h -k | awk 'NR==2 {print $2}'`"
freestorage="`df / -h -k | awk 'NR==2 {print $4}'`"
uptime="`cat /proc/uptime | awk '{printf "%.0f\n", $1/3600}'`"
load="`cat /proc/loadavg | awk '{print $2}'`"
rx="`cat /proc/net/dev | grep eth0 | awk '{printf "%.0f\n", $2/1024}'`"
tx="`cat /proc/net/dev | grep eth0 | awk '{printf "%.0f\n", $10/1024}'`"
alarm="false"

status=$(ps ax | grep httpd | tail -1)
if [ "$status" == "" ]; then alarm="httpd"
fi

curl --silent --connect-timeout 10 --output /dev/null "$url?name=$name&c=$cores&r=$total&u=$used&s=$totalstorage&f=$freestorage&t=$uptime&l=$load&rx=$rx&tx=$tx&a=$alarm"
#wget --quiet --output-document /dev/null "$url?name=$name&c=$cores&r=$total&u=$used&s=$totalstorage&f=$freestorage&t=$uptime&l=$load&rx=$rx&tx=$tx&a=$alarm"
sleep 600
done


cpu number, total memory, free memory, total space, free space, uptime, load, alarm
nohup /monitoring.sh </dev/null >/dev/null 2>&1 &
With buffers/cache

total="`free | awk 'NR==2 {print $2}'`"
free="`free | awk 'NR==2 {print $4}'`"
used=`expr $total - $free`
linux/sendstatus.txt · Last modified: 2016/08/03 14:11 by Jan Forman