Created
June 9, 2012 20:25
-
-
Save ssm/2902450 to your computer and use it in GitHub Desktop.
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
diff --git a/plugins/node.d/snmp__swap.in b/plugins/node.d/snmp__swap.in | |
index 06c355f..de1d476 100644 | |
--- a/plugins/node.d/snmp__swap.in | |
+++ b/plugins/node.d/snmp__swap.in | |
@@ -52,8 +52,12 @@ my $swapsize = 0; | |
my $swapused = 0; | |
foreach my $swap (keys %$swap_d) { | |
- $swapsize += $session->get_single($hrStorageSize . $swap); | |
- $swapused += $session->get_single($hrStorageUsed . $swap); | |
+ my $size = $session->get_single($hrStorageSize . $swap); | |
+ next unless $size ~ /^\d+$/; | |
+ my $used = $session->get_single($hrStorageUsed . $swap); | |
+ next unless $used ~ /^\d+$/; | |
+ $swapsize += $size; | |
+ $swapused += $used; | |
} | |
if (defined $ARGV[0] and $ARGV[0] eq "config") { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment