2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #299 from claudius23/zfs_usage_

plugins/zfs/zfs_usage_ add environment variables, call zfs binary only once
This commit is contained in:
Steve Schnepp 2013-05-07 02:25:58 -07:00
commit 7bd75f1bfb

View File

@ -11,6 +11,19 @@ zfs_usage_ - Script to monitor zfs pool usage
Create one symlink per zpool for exampe zfs_usage_system
if you need to override the defaults below:
[zfs_usage_*]
env.zpoolexec - Path to zpool binary
env.zfsexec - Path to zfs binary
=head2 DEFAULT CONFIGURATION
[zfs_usage_*]
env.zpoolexec /sbin/zpool
env.zfsexec /sbin/zfs
=head1 BUGS
=head1 AUTHOR
@ -35,8 +48,8 @@ need_multigraph();
my $filesystems;
my $zpool;
my $zpoolexec="/sbin/zpool";
my $zfsexec="/sbin/zfs";
my $zpoolexec = (defined($ENV{'zpoolexec'}) ? $ENV{'zpoolexec'} : '/sbin/zpool');
my $zfsexec = (defined($ENV{'zfsexec'}) ? $ENV{'zfsexec'} : '/sbin/zfs');
my $properties = {
available => "Read-only property that identifies the amount of disk"
@ -142,20 +155,15 @@ my @order = (
);
sub do_collect {
my $fslist=(`$zfsexec list -H -r -o name $zpool`);
my @params = join(',',( keys %{$properties} ));
my $fsget="$zfsexec get -H -p -r -t filesystem,volume @params $zpool";
my $fsget="$zfsexec get -H -p @params";
foreach my $fsname (split(/\n/,$fslist)) {
foreach my $line (split(/\n/, `$fsget $fsname` )) {
foreach my $line (split(/\n/, `$fsget` )) {
my ($name, $key, $value, undef ) = (split(/\t/,$line));
($name =~ s/\//_/g);
$filesystems->{$name}->{$key}=$value;
}
}
}
sub do_config_fs {