Skip to content

Instantly share code, notes, and snippets.

@ruchim
Created December 5, 2017 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruchim/e713a0b24eb5c30a6634d3535d985458 to your computer and use it in GitHub Desktop.
Save ruchim/e713a0b24eb5c30a6634d3535d985458 to your computer and use it in GitHub Desktop.
sample monitoring script
#!/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