3

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?

0

3 Answers 3

2

Process accounting (package psacct) can also help.

2
  • Read this question: unix.stackexchange.com/questions/25225/… Commented Jan 13, 2012 at 16:07
  • @Alien Life Form - +1 but a little more elaboration would be nice Commented Jan 13, 2012 at 16:27
1

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

3
  • 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? Commented Jan 13, 2012 at 15:39
  • Also it would be nice to have a way to order processes by highest CPU usage. Commented Jan 13, 2012 at 16:11
  • 2
    ps aux |sort -n -k 3 Commented Jan 13, 2012 at 16:16
1

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.

1
  • 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? Commented Jan 14, 2012 at 17:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.