Skip to content

Instantly share code, notes, and snippets.

@ssm
Created June 9, 2012 20:25
Show Gist options
  • Save ssm/2902450 to your computer and use it in GitHub Desktop.
Save ssm/2902450 to your computer and use it in GitHub Desktop.
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