-
-
Save kezenwa/89b394f95756e5767948ca18480bde10 to your computer and use it in GitHub Desktop.
echos memory, disk and cpu usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf "Memory\t\tDisk\t\tCPU\n" | |
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)}') | |
echo "$MEMORY\t$DISK\t$CPU" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n5 stats.sh >> stats.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment