Server utilization

Gary Ansok gansok at digisle.net
Wed Aug 9 15:29:45 CDT 2000


> Mark Widawer wrote:
> Haven't tried the regex mods you suggested at lunch yet, but I likely
> will tonight.

A better solution may be to store your substitution strings in a single
hash rather than in separate variables.

my %subs = (var1 => 'value1', var2 => 'value2');
s/%%(\w+)%%/$subs{$1}/g;

I think this is actually the "recommended" way.  It works fine whether
the hash is "my" or global.  I have a recollection that using the
symbolic references can also be dangerous if your input is coming from
untrusted sources (perhaps not in this simple case), whereas the hash is
safer.

> I want to monitor the load on my *nix web server. I know I can watch
> the numbers with top, but I'd like to have the server record them so I
> can graph them later. I'm sure there is a way to do this already.

I don't know of anything better than just running top (or some other
program that has the info you need) and parsing the output. "top" has a
batch mode where it will just print the info once and exit.

Sounds like a good candidate for a module!

-- Gary



More information about the Thousand-oaks-pm mailing list