Created
December 5, 2017 18:54
-
-
Save ruchim/e713a0b24eb5c30a6634d3535d985458 to your computer and use it in GitHub Desktop.
sample monitoring script
This file contains 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
#!/bin/bash | |
echo ================================== | |
echo =========== MONITORING =========== | |
echo ================================== | |
echo --- General Information --- | |
echo \#CPU: $(nproc) | |
echo Total Memory: $(free -h | grep Mem | awk '{ print $2 }') | |
echo Total Disk space: $(df -h | grep cromwell_root | awk '{ print $2}') | |
echo | |
echo --- Runtime Information --- | |
function runtimeInfo() { | |
echo [$(date)] | |
echo \* CPU usage: $(top -bn 2 -d 0.01 | grep '^%Cpu' | tail -n 1 | awk '{print $2}')% | |
echo \* Memory usage: $(free -m | grep Mem | awk '{ OFMT="%.0f"; print ($3/$2)*100; }')% | |
echo \* Disk usage: $(df | grep cromwell_root | awk '{ print $5 }') | |
} | |
while true; do runtimeInfo; sleep 300; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment