From fe1369816757ebdc7e47c8e31a21ea47079e8c73 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Tue, 10 Jan 2012 10:46:55 +0100 Subject: [PATCH] naf: Retry to find volume with(out) ending slash Signed-off-by: Sven Velt --- check_naf.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/check_naf.py b/check_naf.py index ebb4b6d..f9dec94 100755 --- a/check_naf.py +++ b/check_naf.py @@ -619,10 +619,18 @@ class CheckNAF(SNMPMonitoringPlugin): def common_vol_idx(self, volume): - if volume.endswith('.snapshot'): - return None + if volume.endswith('.snapshot') or volume.endswith('.snapshot/'): + return (None, None) idx = self.find_in_table(self.OID['df_FS_Index'], self.OID['df_FS_Name'] , volume) + + if idx == None: + # Retry without/with Slash + if volume[-1] == '/': + idx = self.find_in_table(self.OID['df_FS_Index'], self.OID['df_FS_Name'] , volume[:-1]) + else: + idx = self.find_in_table(self.OID['df_FS_Index'], self.OID['df_FS_Name'] , volume + '/') + if idx != None: sn_idx = int(idx) + 1 else: