From 1bf71dec015e1989cc0e82bb9f0892e4bda82967 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 11 Feb 2011 13:43:43 +0100 Subject: [PATCH] check_naf: vol_snap now works with no snap reserve Signed-off-by: Sven Velt --- check_naf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/check_naf.py b/check_naf.py index 5ce3fb9..8afd3de 100755 --- a/check_naf.py +++ b/check_naf.py @@ -553,10 +553,14 @@ class CheckNAF(SNMPMonitoringPlugin): sn_used = long(self.SNMPGET(self.OID['df_FS_kBUsed'], sn_idx)) * 1024L # sn_avail = long(self.SNMPGET(self.OID['df_FS_kBAvail'], sn_idx)) * 1024L - sn_pctused = float(sn_used) / float(sn_total) * 100.0 - warn = self.range_dehumanize(warn, sn_total) crit = self.range_dehumanize(crit, sn_total) + if sn_total != 0: + # Snap reserve + sn_pctused = float(sn_used) / float(sn_total) * 100.0 + else: + # No snap reserve + sn_pctused = 0.0 returncode = self.value_wc_to_returncode(sn_used, warn, crit) output = volume + '.snapshot: Used ' + self.value_to_human_binary(sn_used, 'B')