Skip to content

Commit

Permalink
server status sent every 1 second
Browse files Browse the repository at this point in the history
  • Loading branch information
Diuda committed Jul 16, 2017
1 parent 9b4cfb7 commit 44703e4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions status.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#! /bin/bash

MEMORY=$(free -m | awk 'NR==2{printf "%.2f\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%.2f\t\t\n", $(NF-2)}')
D=$(echo $DISK| cut -d '%' -f 1)
while true
do
MEMORY=$(free -m | awk 'NR==2{printf "%.2f\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%.2f\t\t\n", $(NF-2)}')
D=$(echo $DISK| cut -d '%' -f 1)

curl --data "memory=$MEMORY&cpu=$CPU&disk=$DISK" https://www.diuda.me:444/status
curl --data "memory=$MEMORY&cpu=$CPU&disk=$DISK" https://www.diuda.me:444/status
sleep 1
done

0 comments on commit 44703e4

Please sign in to comment.