topcpu

Name

topcpu -- Reports top CPU users on the system.

Description

Although the procinfo module may be used to monitor specific processes on the system, at times it may be more desirable to learn of the processes using the most resources on the system. The three "top" modules report on the processes with the most number of instances, most CPU usage, and most memory usage. The actual number of processes to report is configurable.

On Linux, process information is collected through files in the "/proc" directory. Specifically, "/proc/meminfo", "/proc/uptime", "/proc/x/cmdline", and "/proc/x/stat" are used, where in the last two "x" represents the PIDs of processes on the machine.

On the Solaris OS, information is gathered through "/proc/x/psinfo" and "/proc/x/lwp", where "x" represents the PIDs of processes on the machine.

Windows 2000/XP/2003 uses the Performance Data Helper to gather all process information. Unfortunately this module is not available in Windows 9x/NT as process-specific CPU usage is not available.

Configuration

Configuration of topcpu is very simple. There is only one variable which may be set: top. This tells topcpu how many processes to return. The number may be anywhere from 1 to 10, and if not specified a default value of 5 will be used. For example:

config
{
	top = 3
}
		

This tells topcpu to report the top 3 CPU users on the system.

Thresholds

One threshold may be set for topcpu with the name "cpu". This will take the process with the most amount of CPU usage, and compare it against the value given in the threshold. Any of the basic logical operators are allowed (==, !=, <, >, <=, >=). For example:

# Example threshold for topcpu
thresh1.threshold = TopCpu.cpu > 90%
		

So if any process uses more than 90% of CPU time, the preceeding threshold will become crossed.

History Data

Each time topcpu checks data, it will save the top users along with their values. This data, using the RSP History Viewer or RSP Web tools, can be used to show trends in process CPU usage over time.