Additional scripts for Zabbix agent on Linux to discover and monitor several services
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.
 
 

39 lines
576 B

#!/usr/bin/perl -w
use Linux::LVM;
Linux::LVM->units(B);
if (@ARGV < 2){
usage();
exit(1);
}
my $vol = $ARGV[0];
my $what = $ARGV[1];
sub usage {
print<<"EOF";
Usage: $0 <logical volume> [size|allocation|status]
EOF
}
my %info = get_lv_info($vol);
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);