From cd94a91f0c178a8de3c672ceea2612803598d648 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Tue, 4 Jun 2024 02:28:44 -0500 Subject: [PATCH] tweak zfs a bit --- snmp/zfs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/snmp/zfs b/snmp/zfs index 6a14acdad..7b2412ced 100755 --- a/snmp/zfs +++ b/snmp/zfs @@ -6,7 +6,7 @@ zfs - LibreNMS JSON SNMP extend for gathering backups for ZFS =head1 VERSION -0.1.0 +0.1.1 =head1 DESCRIPTION @@ -80,8 +80,6 @@ use MIME::Base64; use IO::Compress::Gzip qw(gzip $GzipError); use Pod::Usage; -#$Getopt::Std::STANDARD_HELP_VERSION = 1; - sub main::VERSION_MESSAGE { pod2usage( -exitval => 255, -verbose => 99, -sections => qw(VERSION), -output => \*STDOUT, ); } @@ -289,6 +287,13 @@ my $recently_used_percent; my $frequently_used_percent; if ( !defined( $stats_stuff->{p} ) && defined( $stats_stuff->{mfu_size} ) ) { $stats_stuff->{p} = $stats_stuff->{size} - $stats_stuff->{mfu_size}; +} elsif ( !defined( $stats_stuff->{p} ) + && !defined( $stats_stuff->{mfu_size} ) + && defined( $stats_stuff->{pd} && defined( $stats_stuff->{pm} ) ) ) +{ + # see https://github.com/librenms/librenms-agent/issues/518 + # this should set the value for p in those cases + $stats_stuff->{p} = $stats_stuff->{pd} + $stats_stuff->{pm}; } if ( $stats_stuff->{size} >= $stats_stuff->{c} ) { if ( !defined($mfu_size) ) {