On some system (debian), logical volume already have /dev/$group in their name

So fix the logical volume name in this case
tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 12 years ago
parent 6137dbbab2
commit c9cc8235c4
  1. 6
      zabbix_scripts/disco_lvm_sudo

@ -13,7 +13,8 @@ if ($what eq "volumes"){
foreach my $group (get_volume_group_list()){ foreach my $group (get_volume_group_list()){
my %lvs = get_logical_volume_information($group); my %lvs = get_logical_volume_information($group);
foreach my $lv (keys %lvs){ foreach my $lv (keys %lvs){
push @{$json->{data}}, { "{#LVMVOL}" => "/dev/$group/$lv" }; $lv = ($lv =~ m!^/dev/$group!) ? $lv : "/dev/$group/$lv";
push @{$json->{data}}, { "{#LVMVOL}" => "$lv" };
} }
} }
} }
@ -22,7 +23,8 @@ elsif ($what eq "snapshots"){
my %lvs = get_logical_volume_information($group); my %lvs = get_logical_volume_information($group);
foreach my $lv (keys %lvs){ foreach my $lv (keys %lvs){
if (defined $lvs{$lv}->{allocated_to_snapshot}){ if (defined $lvs{$lv}->{allocated_to_snapshot}){
push @{$json->{data}}, { "{#LVMSNAP}" => "/dev/$group/$lv" }; $lv = ($lv =~ m!^/dev/$group!) ? $lv : "/dev/$group/$lv";
push @{$json->{data}}, { "{#LVMSNAP}" => "$lv" };
} }
} }
} }

Loading…
Cancel
Save