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.

50 lines
1012 B

#!/usr/bin/perl -w
use Zabbix::Agent::Addons::LVM;
Zabbix::Agent::Addons::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|allocation_pool_data|allocation_metadata|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 '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'){
print $info{status};
}
else{
usage();
}
exit(0);