NAME
Linux::Info::DiskStats - Collect Linux disks statistics.
VERSION
version 2.12
SYNOPSIS
use Linux::Info::DiskStats;
my $config = Linux::Info::DiskStats::Options->new({backwards_compatibility => 0});
my $lxs = Linux::Info::DiskStats->new($config);
$lxs->init;
sleep 1;
my $stat = $lxs->get;
Or
my $config = Linux::Info::DiskStats::Options->new({backwards_compatibility => 1,
global_block_size => 4096});
my $lxs = Linux::Info::DiskStats->new($config);
$lxs->init;
my $stat = $lxs->get;
DESCRIPTION
Linux::Info::DiskStats
gathers disk statistics from the virtual /proc filesystem (procfs).
For more information read the documentation of the front-end module Linux::Info.
DISK STATISTICS
The disk statics will depend on the kernel version that is running in the host. See the "SEE ALSO" in Linux::Info::DiskStats section for more details on that.
Also, this module produces two types of statistics:
Backwards compatible with
Linux::Info
versions 1.5 and lower.New fields since version 1.6 and higher. These fields are also incompatible with those produced by Sys::Statistics::Linux.
Backwards compatible fields
Those fields are generated from /proc/diskstats or /proc/partitions, depending on the kernel version.
Not necessarily those fields will have a direct correlation with the fields on the /proc directory, some of them are basically calculations and others are not even statistics (major
and minor
).
These fields are kept only to provide compatibility, but it is highly recommended to not use compatibility mode since some statistics won't be exposed and you can always execute the calculations yourself with that set.
major: The mayor number of the disk
minor: The minor number of the disk
rdreq: Number of read requests that were made to physical disk per second.
rdbyt: Number of bytes that were read from physical disk per second.
wrtreq: Number of write requests that were made to physical disk per second.
wrtbyt: Number of bytes that were written to physical disk per second.
ttreq: Total number of requests were made from/to physical disk per second.
ttbyt: Total number of bytes transmitted from/to physical disk per second.
The "new" fields
Actually, those fields are not really new: they are the almost exact representation of those available on the respective /proc file, with small differences in the fields naming in this module in order to make it easier to type in.
These are the fields you want to use, if possible. It is also possible to have the calculated fields by using the module Linux::Info::DiskStats::Calculated.
METHODS
new
Call new
to create a new object.
my $lxs = Linux::Info::DiskStats->new($opts);
Where $opts
is a Linux::Info::DiskStats::Options.
init
Call init
to initialize the statistics.
$lxs->init;
get
Call get
to get the statistics. get()
returns the statistics as a hash reference.
my $stat = $lxs->get;
raw
Get raw values, retuned as an hash reference.
fields_read
Returns an integer telling the number of fields process in each line from the source file.
EXPORTS
Nothing.
SEE ALSO
proc(5)
https://docs.kernel.org/admin-guide/iostats.html
AUTHOR
Alceu Rodrigues de Freitas Junior <glasswalk3r@yahoo.com.br>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Alceu Rodrigues de Freitas Junior.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007