Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: How to Monitor System Resources

by smiffy (Pilgrim)
on Oct 26, 2008 at 06:28 UTC ( #719618=note: print w/replies, xml ) Need Help??

in reply to How to Monitor System Resources

The Sys::Info approach as suggested by sflitman looks cool although I've never tried it myself.

As Windows is only 'possible future' and for the sake of TIMTOWTDI, run man top on one of your Un*x boxes and have a look at the -b option: batch mode. You could always call this from within Perl and then use the output however you wish.

I am not an expert at making system calls from within Perl so can't advise which of the various methods would suit this best. If you run top with -n 1 (only iterate once), I'd guess any of them should work. It's when you've got recurring output that things would get a bit more complicated. Of course, you could always call top -b from a shell script and have it piping to Perl.

But I'd still say that Sys::Info would be best ;-)

Update - forgot to say that you should probably check the man page for top on your target platforms just in case flags differ. Having just checked on the other (not Linux) OS I have here - FreeBSD - I note that the -n flag has a different meaning. So much for standardisation.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://719618]
choroba sees 5
Discipulus more.. and count cloaked monks..
shmem joins the club
[Discipulus]: welcome back to Tkperlmonks virtualsue! ;=)
[virtualsue]: I missed my 17 year anniversary
[erix]: a virtualanniversary , seems apt enough :P
[marto]: :(
[Discipulus]: we can remedy: ♪♫ Happy monkday to you, Hapymonkday virtualsue..♫..
hippo waves at the other 6

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-04-24 11:03 GMT
Find Nodes?
    Voting Booth?