Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting system info using perl

Status
Not open for further replies.

jimberger

Programmer
Jul 5, 2001
222
GB
hi all,

Is they anyway I can get some system information of my web server using perl commands. I have used system calls to get for example the httpd processes running, and disk space available, but is they anyway i can get the information provided by the top command.

Thanks for your help

jim
 
You can run any system command in Perl. Here's some examples:

system("top n 5 > $file"); # Parse $file for info
`top n 5 > $file`; # Parse $file for info
$topout = `top n 5`; # Parse $topout for info
 
thanks raider.

i tried system (top -n 5 > top.txt")

but this comes up with the following errro in error logs

sh: top: not found

any ideas what i'm doing wrong?

thanks for your help
jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top