You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
576 B
40 lines
576 B
12 years ago
|
#!/usr/bin/perl -w
|
||
12 years ago
|
|
||
12 years ago
|
use Linux::LVM;
|
||
|
|
||
|
Linux::LVM->units(B);
|
||
12 years ago
|
|
||
12 years ago
|
if (@ARGV < 2){
|
||
|
usage();
|
||
|
exit(1);
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
my $vol = $ARGV[0];
|
||
|
my $what = $ARGV[1];
|
||
|
|
||
|
sub usage {
|
||
|
print<<"EOF";
|
||
|
|
||
|
Usage: $0 <logical volume> [size|allocation|status]
|
||
|
|
||
|
EOF
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
my %info = get_lv_info($vol);
|
||
12 years ago
|
|
||
12 years ago
|
if ($what eq 'size'){
|
||
|
print $info{size};
|
||
|
}
|
||
|
elsif ($what eq 'allocation'){
|
||
|
my $ret = (defined $info{allocated_to_snapshot}) ? $info{allocated_to_snapshot} : "ZBX_NOTSUPPORTED";
|
||
|
$ret =~ s/,/\./;
|
||
|
print $ret;
|
||
|
}
|
||
|
elsif ($what eq 'status'){
|
||
|
print $info{status};
|
||
|
}
|
||
|
else{
|
||
|
usage();
|
||
|
}
|
||
|
exit(0);
|