Discover thin pools, and report thin pool allocation

tags/zabbix-agent-addons-0.2.20-1 0.1.20_el5
Daniel Berteaud 10 years ago
parent 54e4be8804
commit f83c0e60d1
  1. 12
      zabbix_scripts/check_lvm_sudo
  2. 11
      zabbix_scripts/disco_lvm_sudo

@ -15,7 +15,7 @@ my $what = $ARGV[1];
sub usage { sub usage {
print<<"EOF"; print<<"EOF";
Usage: $0 <logical volume> [size|allocation|status] Usage: $0 <logical volume> [size|allocation|allocation_pool_data|allocation_metadata|status]
EOF EOF
} }
@ -30,6 +30,16 @@ elsif ($what eq 'allocation'){
$ret =~ s/,/\./; $ret =~ s/,/\./;
print $ret; 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'){ elsif ($what eq 'status'){
print $info{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"){ elsif ($what eq "groups"){
foreach my $group (get_volume_group_list()){ foreach my $group (get_volume_group_list()){
push @{$json->{data}}, { "{#LVMGRP}" => $group }; push @{$json->{data}}, { "{#LVMGRP}" => $group };

Loading…
Cancel
Save