From 58b5a9a414304f2ff7fd2994a0261f65b4c2de9c Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 2 Jul 2015 18:57:08 +0200 Subject: [PATCH] + Enhance mode netapp --- storage/netapp/snmp/mode/filesys.pm | 8 +++++++- storage/netapp/snmp/mode/qtreeusage.pm | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/storage/netapp/snmp/mode/filesys.pm b/storage/netapp/snmp/mode/filesys.pm index 324391881..6c972f721 100644 --- a/storage/netapp/snmp/mode/filesys.pm +++ b/storage/netapp/snmp/mode/filesys.pm @@ -137,9 +137,15 @@ sub custom_usage_calc { $self->{result_values}->{dfDedupeSavedPercent} = $options{new_datas}->{$self->{instance} . '_dfDedupeSavedPercent'}; return 0 if ($options{new_datas}->{$self->{instance} . '_total'} == 0); - $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used}; $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total}; + + $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used}; $self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used}; + # snapshot can be over 100% + if ($self->{result_values}->{free} < 0) { + $self->{result_values}->{free} = 0; + $self->{result_values}->{prct_free} = 0; + } return 0; } diff --git a/storage/netapp/snmp/mode/qtreeusage.pm b/storage/netapp/snmp/mode/qtreeusage.pm index 866b36d9e..30b548c84 100644 --- a/storage/netapp/snmp/mode/qtreeusage.pm +++ b/storage/netapp/snmp/mode/qtreeusage.pm @@ -123,6 +123,11 @@ sub custom_usage_calc { $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total}; $self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used}; $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used}; + # qtree can be over 100% + if ($self->{result_values}->{free} < 0) { + $self->{result_values}->{free} = 0; + $self->{result_values}->{prct_free} = 0; + } return 0; }