Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Location
    Melbourne, Australia
    Posts
    310

    Question about server load stuff

    Does anyone know of a script that will email me with a list of processes running (sorted by CPU time) whenever the server load exceeds a particular level? I've recently been getting some load problems, but I'm not sure what's causing it (as I'm usually not online when it happens). This is on a cPanel server using PHP Suexec (if it matters at all)

    Here's a recent graph:
    http://www.daniel15.com/stuff/cwh/load-graph_image.png

    I've got a feeling it's a cron job of some description, but I don't know for sure (as by the time I log in, it's already back to normal)

    Thanks,
    Daniel15

  2. #2
    Join Date
    Jan 2004
    Location
    York, UK
    Posts
    371
    It shoudl be fairly simple to knock a script to do that together in bash:
    1. get the load average from /proc/loadavg
    2. if greater than (say) 10, run top redirected to a file
    3. sleep for a while (30 seconds?)

    That way yoiu'll have a file with containing a listing from top for every time the load went above a certain value. If your version of top does not include a timestamp, you'll want to add your own with something like "date >> busy.log.file" after the top command.

    If you suspect that it is a cron job though, would it not be easier to look through the crontabs to see what gets kicked off around that time and not other times?

    Or if it is very regular, just btry be online at the time?

    High loadavg values can be cause by queued I/O rather than the CPU(s) being busy doing real work (i.e. the OS is in I/O Wait state for a large portion of each second). The most common causes of suddern bursts of I/O activity at a regular time are backup operations and log analysis runs.

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •