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.

How it can be done without writing additional daemon?

P.S. I can't use cron because I need lesser time intervals.

P.P.S. Debian 6 x64

share|improve this question
    
Is there some specific reason you want to be utterly abusive to your system? Load average is only calculated on a 1/5/15 minute basis. Trying to monitor it every 1-5 seconds is just going to drive the number up to no good effect... –  voretaq7 Oct 22 '12 at 15:45

1 Answer 1

up vote 2 down vote accepted

Use Monit as a lightweight system monitoring tool.

Here's the documentation. You will find examples of how to do alerts and actions depending on system conditions, like load. For example:

check system server.example.com
  if loadavg (1min) > 4       for 10 cycles then alert
  if loadavg (5min) > 3       for 10 cycles then alert
  if loadavg (15min) > 2      for 10 cycles then alert
  if memory usage > 75%       for 10 cycles then alert
  if cpu usage (user) > 70%   for 10 cycles then alert
  if cpu usage (system) > 50% for 10 cycles then alert
  if cpu usage (wait) > 50%   for 10 cycles then alert

Where "alert" is defined in a different configuration section.

Monit should be available in apt on Debian. Yes, it's an extra thing to install and run, but it's fairly lightweight, and it'll be better than anything you will cook up in a shell script.

share|improve this answer
    
That's suitable, thanks! –  user973254 Oct 20 '12 at 13:28

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.