Skip to content

Commit

Permalink
zfs: handle a edge case that seems to affect some Linux installs for …
Browse files Browse the repository at this point in the history
…ZFS #523
  • Loading branch information
VVelox authored Jul 25, 2024
1 parent 7aeb463 commit de1bfc6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions snmp/zfs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ zfs - LibreNMS JSON SNMP extend for gathering backups for ZFS
=head1 VERSION
0.1.0
0.1.1
=head1 DESCRIPTION
Expand Down Expand Up @@ -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, );
}
Expand Down Expand Up @@ -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) ) {
Expand Down

0 comments on commit de1bfc6

Please sign in to comment.