Changeset 137adeacfa90491a37b256709b3f05d793547d6e

Show
Ignore:
Timestamp:
05/20/10 02:32:10 (4 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1274322730 +0000
git-parent:

[e607684de2bdbf415825c461584e8c8437511ab4]

git-author:
Mark Harrison <mark@omniti.com> 1274322730 +0000
Message:

Convert the Core::ZpoolFree? module to be a wildcard module (refs #8)

git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@388 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Core/ZpoolFree.pm

    rc3d87d4 r137adea  
    1717 
    1818 Core::ZpoolFree { 
    19      zpools: noop 
     19     * : noop 
    2020 } 
    2121 
    2222 Core::ZpoolFree { 
    23      zpools: zfs_path = '/sbin/zfs' 
     23     * : zfs_path => '/sbin/zfs' 
    2424 } 
    2525 
     
    6060=head1 METRICS 
    6161 
    62 A set of metrics is returned for each pool on the system, with the name of the 
    63 pool being used as a prefix. For example, if you have rpool and data pools, 
    64 then you will end up with both rpool_free_KB and data_free_KB (as well as the 
    65 rest of the metrics for each pool). 
     62A set of metrics is returned for each pool on the system. 
    6663 
    6764=over 
    6865 
    69 =item poolname_free_MB 
     66=item free_MB 
    7067 
    7168The amount of free space in the pool, measured in megabytes. 
    7269 
    73 =item poolname_used_MB 
     70=item used_MB 
    7471 
    7572The amount of used space in the pool, measured in megabytes. 
    7673 
    77 =item poolname_percent_full 
     74=item percent_full 
    7875 
    7976The amount of used space in the pool, expressed as a percentage of the total 
     
    9592); 
    9693 
    97 sub handler { 
     94sub wildcard_handler { 
    9895    my $self = shift; 
    9996    my $config = $self->{config}; # All configuration is in here 
     
    119116 
    120117        my $percent_full = sprintf("%.2f", ($used / ($used + $free)) * 100); 
    121         $status->{"${name}_used_MB"} = [int($used/1048576), "i"]; 
    122         $status->{"${name}_free_MB"} = [int($free/1048576), "i"]; 
    123         $status->{"${name}_percent_full"} = [$percent_full, "n"]; 
     118        $status->{$name}->{"used_MB"} = [int($used/1048576), "i"]; 
     119        $status->{$name}->{"free_MB"} = [int($free/1048576), "i"]; 
     120        $status->{$name}->{"percent_full"} = [$percent_full, "n"]; 
    124121    } 
    125122