The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sys::Statgrab - Extension of Unix::Statgrab for greater portability

SYNOPSIS

    use Sys::Statgrab;

    local $, = "\n";
    
    my $host = get_host_info or 
        die get_error;
        
    print $host->os_name, 
          $host->os_release,
          $host->os_version,
          ...;

    my $disks = get_disk_io_stats or
        die get_error;
        
    for (0 .. $disks->num_disks - 1) {
        print $disks->disk_name($_),
              $disks->read_bytes($_),
              ...;
    }

DESCRIPTION

Sys::Statgrab is an attempt to provide support for platforms unsupported by Unix::Statgrab, and to complete support for other platforms that Unix::Statgrab currently only partially supports. If your platform natively supports all Unix::Statgrab interface functions, then this module will silently act as a pass-through wrapper for Unix::Statgrab.

BACKGROUND

What is Unix::Statgrab?

Unix::Statgrab is a wrapper for libstatgrab as available from http://www.i-scream.org/libstatgrab/. It is a reasonably portable attempt to query interesting stats about your computer. It covers information on the operating system, CPU, memory usage, network interfaces, hard-disks etc.

Why did I make this module?

...instead of spending the time directly supporting the native C libstatgrab project? I am a strong believer in the interface of libstatgrab and use it in many Perl projects, but I simply cannot find the time necessary code and debug large C patches for that project. Also, there are some current limitations in some platforms (e.g. cygwin) at this time that prevent libstatgrab from being able to be completely ported without using a combination of external utilities and other open-source libraries.

Thus, the next best contribution I can offer is to encourage greater interest in libstatgrab, starting with the Perl user community, such that other developers may take an interest in working with the libstatgrab authors to add and complete native support for new platforms. Ideally, as libstatgrab platform support grows, this module will eventually be reduced to a simple pass-through for Unix::Statgrab, at which time that module would likely inherit the Sys:: package namespace of this module.

USAGE

See Unix::Statgrab for complete usage documentation.

TODO

Complete as much support as possible for Cygwin (beyond libstatgrab's support, only get_process_stats() has been implemented). Possibly use combo of cygwin netstat and Win32::NetPacket. Maybe try interfacing with other open source tools tools like Etherial.

Complete support for Win32 (extending upon the prelimiary libstatgrab support in MinGW).

Support other platforms, or missing native libstatgrab support for some functions in your current platform? Contact me (or send me your patches), and I'll see what we can do!

CAVIATS

If using Cygwin, you must have procps (available as a Cygwin package) installed to be able to obtain process-level CPU utilization percentage stats; otherwise, cpu_percent will return undef.

BUGS

None known at this time, although there may be a few minor ones lurking about. Bug reports and suggestions are always welcome.

CREDITS

Tassilo von Parseval

For writing Unix::Statgrab, for the base test script for this module, and for supporting ideas of portability beyond libstatgrab's current capabilities.

AUTHOR

Eric Rybski

COPYRIGHT AND LICENSE

Copyright 2006 by Eric Rybski, All Rights Reserved

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Unix::Statgrab