You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

15 lines
383 B

  1. #!/bin/bash
  2. while :
  3. do
  4. CPUUSAGE="$(top -b - n 1 | grep "Cpu" | awk '{print 100-$8}')%"
  5. MEMUSAGE="$(free -h | grep "Mem" | awk '{print $3/$2*100}')%"
  6. # disk usage for root directory
  7. DISKUSAGE="$(df -h | awk '{ if ($6 == "/")
  8. print $5;
  9. }')"
  10. echo "$(date) CPU: $CPUUSAGE Mem: $MEMUSAGE Disk:$DISKUSAGE" >> /var/log/system_utilization.log
  11. sleep 15
  12. done