I use nagios to monitor my server. Once in a while I'll get a report that the CPU load is warning / critical, etc. Usually this happens at some odd hour or when I don't have the tools to immediately log in and look around.

Is there some way that I can set up the system to take some top snapshots when the CPU usage is very high - either independently on the system or via nagios?


Process accounting (package psacct) can also help.


You could run ps aux >> logfile every minute with cron. It includes CPU usage.

  • That's not bad. But really I only would like to log this when the CPU usage is above a certain threshold. Is there a way to "trigger" it? Or perhaps only store it to a file when it is above a certain point? – cwd Jan 13 '12 at 15:39
  • Also it would be nice to have a way to order processes by highest CPU usage. – cwd Jan 13 '12 at 16:11
  • 2
    ps aux |sort -n -k 3 – Alien Life Form Jan 13 '12 at 16:16

Take a closer look at snmpd (snmpd.conf). If compiled with the right options you can set trigger actions for a number of things - one of these is CPU-load.

  • cool, i like the looks of this. i found the "load average checks" section of the config file - i hope that means it was compiled right on my system. i've been trying to google for instruction on how to "set it up" to give me alerts. what should i be googling for? – cwd Jan 14 '12 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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