Discover thin pools, and report thin pool allocation
This commit is contained in:
parent
54e4be8804
commit
f83c0e60d1
|
@ -15,7 +15,7 @@ my $what = $ARGV[1];
|
|||
sub usage {
|
||||
print<<"EOF";
|
||||
|
||||
Usage: $0 <logical volume> [size|allocation|status]
|
||||
Usage: $0 <logical volume> [size|allocation|allocation_pool_data|allocation_metadata|status]
|
||||
|
||||
EOF
|
||||
}
|
||||
|
@ -30,6 +30,16 @@ elsif ($what eq 'allocation'){
|
|||
$ret =~ s/,/\./;
|
||||
print $ret;
|
||||
}
|
||||
elsif ($what eq 'allocation_pool_data'){
|
||||
my $ret = (defined $info{allocated_pool_data}) ? $info{allocated_pool_data} : "ZBX_NOTSUPPORTED";
|
||||
$ret =~ s/,/\./;
|
||||
print $ret;
|
||||
}
|
||||
elsif ($what eq 'allocation_metadata'){
|
||||
my $ret = (defined $info{allocated_meta_data}) ? $info{allocated_meta_data} : "ZBX_NOTSUPPORTED";
|
||||
$ret =~ s/,/\./;
|
||||
print $ret;
|
||||
}
|
||||
elsif ($what eq 'status'){
|
||||
print $info{status};
|
||||
}
|
||||
|
|
|
@ -30,6 +30,17 @@ elsif ($what eq "snapshots"){
|
|||
}
|
||||
}
|
||||
}
|
||||
elsif ($what eq "thin_pools"){
|
||||
foreach my $group (get_volume_group_list()){
|
||||
my %lvs = get_logical_volume_information($group);
|
||||
foreach my $lv (keys %lvs){
|
||||
if (defined $lvs{$lv}->{allocated_pool_data}){
|
||||
$lv = ($lv =~ m!^/dev/$group!) ? $lv : "/dev/$group/$lv";
|
||||
push @{$json->{data}}, { "{#LVMTHINP}" => "$lv" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($what eq "groups"){
|
||||
foreach my $group (get_volume_group_list()){
|
||||
push @{$json->{data}}, { "{#LVMGRP}" => $group };
|
||||
|
|
Loading…
Reference in New Issue
Block a user