From c9cc8235c492f2474951bf9748ebaf920da4fcca Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 18 Apr 2013 10:13:15 +0200 Subject: [PATCH] On some system (debian), logical volume already have /dev/$group in their name So fix the logical volume name in this case --- zabbix_scripts/disco_lvm_sudo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zabbix_scripts/disco_lvm_sudo b/zabbix_scripts/disco_lvm_sudo index 0069e75..a03ab40 100644 --- a/zabbix_scripts/disco_lvm_sudo +++ b/zabbix_scripts/disco_lvm_sudo @@ -13,7 +13,8 @@ if ($what eq "volumes"){ foreach my $group (get_volume_group_list()){ my %lvs = get_logical_volume_information($group); 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); foreach my $lv (keys %lvs){ 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" }; } } }