OpenVZ::BC - Perl access to OpenVZ Beancounter Data
use OpenVZ::BC; my $bc = OpenVZ::BC->new; my $resources = $bc->hash;
Gives Perl access to OpenVZ beancounter data. This data is typically stored in /proc/user_beancounters or /proc/bc/resources. By default, we use /proc/bc/resources, but this can be overridden as described below.
my $bc = OpenVZ::BC->new; my $bc = OpenVZ::BC->new( bc_file => '/proc/user_beancounters', );
Creates the new OpenVZ::BC object.
If you specify bc_file here, it will override the default location. Currently that default location is /proc/bc/resources. Specified here, it will define the default location of this file for any methods used below.
my $resources = $bc->hash; my $resources = $bc->hash( bc_file => '/proc/user_beancounters', ); my $resources = OpenVZ::BC->hash; my $resources = OpenVZ::BC->hash( bc_file => '/proc/user_beancounters', );
This returns a hashref containing the beancounter data from the default or specified file. If accessed via the $bc object, it will use the default specified in that object. If you use it via the class directly, it will use the class default.
If you specify bc_file here, it will override the default location of either the $bc object and/or the class.
Provide access to the /proc/bc/<VPSID>/resources files to access a single VPS beancounters instead of reading the full server's beancounters. This would involve adding new methods. Patches are welcome.
Dusty Wilson Megagram Managed Technical Services http://www.megagram.com/
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install OpenVZ::BC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenVZ::BC
CPAN shell
perl -MCPAN -e shell install OpenVZ::BC
For more information on module installation, please visit the detailed CPAN module installation guide.