[ILUG] Continuous process monitoring
John_White at dell.com
John_White at dell.com
Mon Sep 17 11:41:18 IST 2001
SNMP + MRTG is what you want . . . .
Though simple it's not . . . .
-----Original Message-----
From: Niall O Broin [mailto:niall at linux.ie]
Sent: 17 September 2001 11:01
To: ilug at linux.ie
Subject: [ILUG] Continuous process monitoring
I manage a box which provides web and mail services for a number of
companies. The load average lately has on occasion gone sky high and I need
to get a handle on what's going on. Of course I can use top, ps or vmstat at
any given moment to see what's happening but I'd like to get a look at
trends or the ongoing situation, particularly WRT memory and CPU usage by
apache and Communigate Pro (a commercial SMTP server). I tried this
#!/usr/bin/perl
open TOP, "top -n1 -b|";
while (<TOP>) {
if ($header_done) {
($cpu, $mem, $command) = unpack("x50 A4 x A4 x8 A*", $_);
$cpu{$command} += $cpu;
$mem{$command} += $mem;
}
$header_done = ($header_done || /PID/)
}
print "Process\tCPU\tMemory\n";
foreach ("httpd", "httpdcomet", "CGServer", "mysqld") {
print "$_\t$cpu{$_}\t$mem{$_}\n";
}
which I intended to run every minute or so, but it's not producing accurate
results - CGServer (the Communigate Pro process, of which there may be ~100
running) uses 112% of CPU - obviously the figures from top are not accurate
enough to do this with them. Does any know of tools which might help ? I
have looked around, but tend to find various things like GUIs for top etc.
which don't really help. I really want to find on a continuous basis how
much of a load the above 4 processes (and there may of course be multiple
instances of each) are producing (BTW httpdcomet is a special version of
apache).
Niall
--
Irish Linux Users' Group: ilug at linux.ie
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: listmaster at linux.ie
More information about the ILUG
mailing list