Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
centos cpu usage one liner
# cpu usage (decimal)
cat /proc/loadavg | cut -d ' ' -f 1
# cpu usage (integral)
cat /proc/loadavg | cut -d ' ' -f 1 | cut -d '.' -f 1
# cpu usage (integral * 100)
cpu=`cat /proc/loadavg | cut -d ' ' -f 1`;echo $cpu*100 | bc | cut -d '.' -f 1
# send your cpu usage (integral) to GrowthForecast every 5 minutes via crontab
*/5 * * * * curl -F number=`cat /proc/loadavg | cut -d ' ' -f 1 | cut -d '.' -f 1` http://localhost:5125/api/yourmachine/system/cpu 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment