-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, 28 Jun 2010, Charles Marcus wrote:
With ps aux, I can see all connections, but they are all pretty much at zero with the exception of those where people are moving messages around and such...
ps xua|perl -e 'while(<>) { @a=split(/\s+/, $_); if($a[10] eq "imap") { $top{substr($a[11],1)} += $a[2] } } foreach $uid (sort {$top{$a} <=> $top{$b} } keys %top) { print $uid, " ", $top{$uid}, "\n" } '
The idea is to catch the lines with "... imap [uid ip]"
To reverse the sort swap $a and $b in sort { }, so one can combine the script with the commands head and watch, in order to build a poor man's top ;-)
To include pop in the stats, add
|| $a[10] eq 'pop3'
to the if(). Well, maybe your output of ps differs as well.
Regards,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBTCmkub+Vh58GPL/cAQLRZwgAzyp6RuvwBzAsdMf3PogaBzucPf9Ps2ST gDriAp2HvDJs3gz65oMWSGGB0iEEeo0JUJbEUk7y10/nHv89P4pPecb9mmrSq59f 6SJcsw01Bpzc3W76LQV9HXYix1ybr8QTpMEQHlk5Hr1Hkwp0488PdZ5IPSnW1Cxh qhyWqOFCp7j4MQ+VGk7Rp0heFWqTw9DaykceP6fMAz/NWVwZvnbTQ/XdsEruGKev 7okXLgO6NN38cQfV/RsX5SpJ3+Yqx4Hx7o3Quut7HtNybG/hJeqBXahRMg56SIkA /RkFmr87BXDU+2srb6rtRxk/EBy5Qekb4R3OMZkRno9amRdUdpLV6Q== =S4/r -----END PGP SIGNATURE-----