At pair Networks, we use a script named "the reaper" to monitor activity on our shared user servers and shut off processes that use too many resources.
Each time a process is "reaped", we create an entry in a text file that looks like these:
Sat Apr 17 13:31:33 EDT 2004 :: (Long-running process) NICE 20: USER ehdonhon, CMD '/usr/local/bin/perl ./score.pl -b -t 0.5'/'perl' Sat Apr 17 13:32:03 EDT 2004 :: (Long-running runaway) KILL -9: PID 13378, USER ehdonhon, CMD '/usr/local/bin/perl ./score.pl -b -t 0.5'/'perl' Sat Apr 17 13:49:34 EDT 2004 :: (Common mail command) NICE 20: USER mattr, CMD '/bin/sh -c preline /usr/local/bin/procmail'/'sh'
We needed a way to let customers access this log, but only the lines that belong to them. We used AnyData:
my $reaperlogs = adTie( 'ReaperLogs', REAPER_LOG_FILE ); my $reaps = $reaperlogs->{ {user => $uname} }; printf ("%s|||%s|||%s|||%s\n", $_->{date}, $_->{action}, $_->{cmd}, $_->{reason}) for ( @$reaps ); |