]> git.michaelhowe.org Git - packages/m/munin-plugins-afs.git/commitdiff
Fix scaling error
authorMichael Howe <michael@michaelhowe.org>
Thu, 27 Dec 2018 10:36:59 +0000 (10:36 +0000)
committerMichael Howe <michael@michaelhowe.org>
Thu, 27 Dec 2018 10:36:59 +0000 (10:36 +0000)
Values returned by AFS tools are in K, but munin assumes they're in
bytes.  Multiplying up by 1024 fixes that.

plugins/afs_volumes_partition_

index 5ae13339968d1f35b17f5b68aa3793416f53af60..79fd9f5aa37bc4d1137329862f7deebf5a39fcac 100755 (executable)
@@ -50,8 +50,8 @@ sub partinfo {
     while( my $line = <$pinfo> ){
         # Free space on partition /vicepa: 1595716 K blocks out of total 4767360
         if( $line =~ m{/vicep[a-z]+:\s+(\d+) K.*total\s+(\d+)\s*$} ){
-            $results{free} = $1;
-            $results{total} = $2;
+            $results{free} = $1 * 1024;
+            $results{total} = $2 * 1024;
             $results{used} = $results{total} - $results{free};
         }
     }
@@ -74,14 +74,14 @@ sub serverinfo {
     my( $volume, $size, %results );
     while( my $line = <$lvol> ){
             if ($line =~ /^(\S+)\s+\d+ RW\s+(\d+) K\s+On-line\s*$/) {
-                ($volume, $size) = ($1, $2);
+                ($volume, $size) = ($1, $2 * 1024);
                 my $orig_vol_name = $volume;
                 $volume =~ s{\.}{_}g;
                 $results{v}{$volume}{size} = $size;
                 $results{v}{$volume}{name} = $orig_vol_name;
                 $results{t}{size} += $size;
             } elsif ($line =~ /^\s+MaxQuota\s+(\d+) K\s*$/ && defined $volume) {
-                $results{v}{$volume}{quota} = $1;
+                $results{v}{$volume}{quota} = $1 * 1024;
                 $results{v}{$volume}{percent} = sprintf "%.2f", ( $results{v}{$volume}{size} / $results{v}{$volume}{quota} * 100 );
                 $results{t}{quota} += $1;
                 $volume = undef;