0

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

user973254
  • 151
  • 5
  • 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 Answers1

2

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.

cjc
  • 24,916
  • 3
  • 51
  • 70