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.

23 lines
736 B

  1. SHELL=/bin/bash
  2. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  3. MAX_PER_PROC=3
  4. ## integer only for the 5m load avg
  5. int_avg=$(while read line; do
  6. echo "$line"
  7. done < /proc/loadavg)
  8. int_avg=${int_avg#* }
  9. int_avg=${int_avg%%.*}
  10. max=$[$MAX_PER_PROC * $(grep -c ^processor /proc/cpuinfo)]
  11. if [ "$int_avg" -gt "$max" ]; then
  12. if [ -e /tmp/load_average_max.lock ]; then
  13. exit 0
  14. else
  15. touch /tmp/load_average_max.lock
  16. message="$(hostname) : WARNING - load average ($int_avg) is above max per processor : ($MAX_PER_PROC * $(grep -c ^processor /proc/cpuinfo) = $max)"
  17. echo $message | logger -t load_average_max
  18. send "load_average_max" "$message"
  19. fi
  20. fi