Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

How to acquire system-information ?

by rapide (Beadle)
on Sep 10, 2008 at 14:41 UTC ( #710374=perlquestion: print w/replies, xml ) Need Help??

rapide has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a way to collect information about the hardware (e.g. CPU(s), memory) of the current running system. I've been looking at Sys::Info::Device::CPU but it's neither portable to windows and it got too many dependencies for an application that will be installed on various systems. Basically, I'm looking for:
- CPU type
- Clock-speed
- number of cores
- average last minute (If this can be done with only the current running script it would be much better)
- memory size

Any advice where to look or how to do it?

Replies are listed 'Best First'.
Re: How to acquire system-information ?
by shmem (Chancellor) on Sep 10, 2008 at 15:07 UTC

    The only portable way to get that information is via SNMP, i.e a snmp daemon running on the system in question, and Net::SNMP on the querying side.

      While it's portable, one can't count on an SNMP daemon being available on a system.

      But if one controls the systems in question and can install SNMP if needed, it will be guaranteed to work.

Re: How to acquire system-information ?
by Corion (Patriarch) on Sep 10, 2008 at 14:42 UTC

    In theory, DBD::WMI (written by me) could be able to give you that information, but this depends on the hardware vendor having written the appropriate drivers.

      Thanks, but if it is possible I would like to avoid such constraints as "if the vendor has ..".
      If process information were only to be collected from UNIX systems, any other suggestions then ?
Re: How to acquire system-information ?
by planetscape (Chancellor) on Sep 11, 2008 at 19:25 UTC
Re: How to acquire system-information ?
by Burak (Chaplain) on Apr 07, 2009 at 18:15 UTC
    > I've been looking at Sys::Info::Device::CPU but it's neither portable to windows

    Actually it's very portable :) It's part of my Sys::Info module and currently Windows, Linux & (Free|Open|Net)BSD is supported. However, fot the windows part the cpu load thing is returned as the current CPU load "ratio". The value you can see in the task manager, which is different than the linuc loadavg. So, it's only an emulation on windows (however, if there is a better way, please send a patch :)

Re: How to acquire system-information ?
by pvaldes (Chaplain) on Nov 07, 2011 at 23:39 UTC
    You can see here an example of the use of Sys::Info

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://710374]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-08-19 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?