Linux-Info
view release on metacpan or search on metacpan
lib/Linux/Info.pm view on Meta::CPAN
In addition it's possible to pass a hash reference with options.
my $lxs = Linux::Info->new(
processes => {
init => 1,
pids => [ 1, 2, 3 ]
},
netstats => {
init => 1,
initfile => $file,
},
);
Option C<initfile> is useful if you want to store initial statistics on the filesystem.
my $lxs = Linux::Info->new(
cpustats => {
init => 1,
initfile => '/tmp/cpustats.yml',
},
diskstats => {
init => 1,
initfile => '/tmp/diskstats.yml',
},
netstats => {
init => 1,
initfile => '/tmp/netstats.yml',
},
pgswstats => {
init => 1,
initfile => '/tmp/pgswstats.yml',
},
procstats => {
init => 1,
initfile => '/tmp/procstats.yml',
},
);
Example:
use strict;
use warnings;
use Linux::Info;
my $lxs = Linux::Info->new(
pgswstats => {
init => 1,
initfile => '/tmp/pgswstats.yml'
}
);
$lxs->get(); # without to sleep
The initial statistics are stored to the temporary file:
#> cat /tmp/pgswstats.yml
---
pgfault: 397040955
pgmajfault: 4611
pgpgin: 21531693
pgpgout: 49511043
pswpin: 8
pswpout: 272
time: 1236783534.9328
Every time you call the script the initial statistics are loaded/stored from/to
the file. This could be helpful if you doesn't run it as daemon and if you want
to calculate the average load of your system since the last call.
To get more information about the statistics refer the different modules of the
distributions below:
=over
=item *
Collect CPU load statistics using L<Linux::Info::CpuStats>
=item *
Collect process statistics using L<Linux::Info::ProcStats>
=item *
Collect memory statistics using L<Linux::Info::MemStats>
=item *
Collect paging and swapping statistics using L<Linux::Info::PgSwStats>
=item *
Collect net statistics using L<Linux::Info::NetStats>
=item *
Collect socket statistics using L<Linux::Info::SockStats>
=item *
Collect disk statistics using L<Linux::Info::DiskStats>
=item *
Collect the disk usage using L<Linux::Info::DiskUsage>
=item *
Collect the load average using L<Linux::Info::LoadAVG>
=item *
Collect inode statistics using L<Linux::Info::FileStats>
=item *
Collect process statistics using L<Linux::Info::Processes>
=back
Besides statistics, it is possible to retrieve qualitative information from
( run in 0.694 second using v1.01-cache-2.11-cpan-df04353d9ac )