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.iehttp://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: listmaster at linux.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!