Created
February 29, 2020 18:39
-
-
Save daviddpd/0cd4c0b2cc815f83960e52bb8b1968c4 to your computer and use it in GitHub Desktop.
dpd vs dan zfs-freebsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./librenms_extends_freebsd/zfs-freebsd 2020-02-29 10:37:16.000000000 -0800 | |
+++ ./librenms-agent/snmp/zfs-freebsd 2020-02-14 10:57:49.000000000 -0800 | |
@@ -1,4 +1,4 @@ | |
-#!/usr/local/bin/perl | |
+#!/usr/bin/env perl | |
=head1 DESCRIPTION | |
@@ -51,7 +51,7 @@ | |
$Getopt::Std::STANDARD_HELP_VERSION = 1; | |
sub main::VERSION_MESSAGE { | |
- print "FreeBSD ZFS stats extend 0.1.0\n"; | |
+ print "FreeBSD ZFS stats extend 0.2.1\n"; | |
} | |
sub main::HELP_MESSAGE { | |
@@ -157,13 +157,15 @@ | |
my $cache_hit_percent = $arc_hits / $arc_accesses_total * 100; | |
my $cache_miss_percent = $arc_misses / $arc_accesses_total * 100; | |
my $actual_hit_percent = $real_hits / $arc_accesses_total * 100; | |
-my $data_demand_percent = $demand_data_hits / $demand_data_total * 100; | |
-my $data_prefetch_percent; | |
+my $data_demand_percent = 0; | |
+if ( $demand_data_total != 0 ){ | |
+ $data_demand_percent = $demand_data_hits / $demand_data_total * 100; | |
+} | |
+ | |
+my $data_prefetch_percent=0; | |
if ( $prefetch_data_total != 0 ) { | |
$data_prefetch_percent = $prefetch_data_hits / $prefetch_data_total * 100; | |
-}else{ | |
- $data_prefetch_percent = 0; | |
} | |
my $anon_hits_percent; | |
@@ -236,14 +238,14 @@ | |
my @toShoveIntoJSON; | |
while ( defined( $pools[$pools_int] ) ) { | |
my %newPool; | |
- | |
+ | |
my $pool=$pools[$pools_int]; | |
$pool =~ s/\t/,/g; | |
- $pool =~ s/\,\-\,/\,0\,/g; | |
+ $pool =~ s/\,\-\,\-\,/\,0\,0\,/g; | |
$pool =~ s/\%//g; | |
$pool =~ s/\,([0-1\.]*)x\,/,$1,/; | |
- ( $newPool{name}, $newPool{size}, $newPool{alloc}, $newPool{free}, $newPool{expandsz}, $newPool{frag}, $newPool{cap}, $newPool{dedup} )=split(/\,/, $pool); | |
+ ( $newPool{name}, $newPool{size}, $newPool{alloc}, $newPool{free}, $newPool{ckpoint}, $newPool{expandsz}, $newPool{frag}, $newPool{cap}, $newPool{dedup} )=split(/\,/, $pool); | |
push(@toShoveIntoJSON, \%newPool); | |
@@ -253,7 +255,7 @@ | |
my %head_hash; | |
$head_hash{'data'}=\%tojson; | |
-$head_hash{'version'}=1; | |
+$head_hash{'version'}=2; | |
$head_hash{'error'}=0; | |
$head_hash{'errorString'}=''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment