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.

I will be running a custom daemon that could potentially spike the server's cpu? Is there a way to log those spikes with their start and running time?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

If youre running linux or other unix variant, there is sar which is installed by default in many distributions. Many times it runs from cron on a defined interval, however you can also run it manually with a specified polling interval

For example:

sar -u 1 0

This will run sar once a second forever. The -u tells it to output the CPU usage info, the 1 is how many seconds between polls, and the 0 is how many times to poll (0 for forever).

It can also watch a specific process with the -x parameter. It can also log its data to a file for later viewing. Sar can do a lot, so consult the man page if you want to do more.

share|improve this answer
    
This is typically what we do too, because it is really quite easy to get it running. The one point is that it takes a snapshot of that point in time. So as long as you are doing them pretty frequently, it isn't a problem. If you bump the interval up to 5 or 10 minutes, you may miss the time when the app is actually spiking. –  Alex Jan 31 '11 at 18:50

Use any monitoring system(Cacti,Zabbix,Munin,...) for monitoring daemon memory usage.

share|improve this answer

Try using cacti:

http://www.cacti.net/index.php

share|improve this answer

I would say if you have a bunch of servers to monitor, get a "utility server" and take the time and setup munin (what I use), or cacti or zenoss or ganglia or whatever you like.

But if it's a one-off server, go with sar, which is part of the sysstat suite. Usually it's run from cron. In Debian systems, you'll have to enable it in /etc/defaults/sysstat. You can graph the results with ksar.

share|improve this answer

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.