Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using a tool like top or htop, is it possible to monitor CPU usage and execute a script if CPU usage exceeds a certain amount?

share|improve this question

2 Answers 2

This would be trivial using a tool like monit.

check system myhost
    if cpu usage (system) > 80% for 4 cycles then alert
    if cpu usage (user) > 80% for 5 cycles then alert
    if cpu usage (wait) > 90% for 5 cycles then alert
share|improve this answer
  1. Cfengine can do with classes and variables. Classes use standard deviation which is more flexible that hard limits.

  2. I think you can do this with net-snmp too.

  3. You can pull loads from sysstat.

  4. Raw numbers in /proc/loadavg.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.