Small collected fixes and improvments

Signed-off-by: Sven Velt <sven@velt.de>
This commit is contained in:
Sven Velt 2011-01-12 13:51:36 +01:00
parent e1c1077d30
commit 634f1c5703
2 changed files with 12 additions and 4 deletions

View file

@ -124,6 +124,7 @@ class CheckNAF(SNMPMonitoringPlugin):
if di_spare > 1: if di_spare > 1:
output += 's' output += 's'
else: else:
target = 'failed' # Set to defined value
returncode = self.value_wc_to_returncode(di_failed, warn, crit) returncode = self.value_wc_to_returncode(di_failed, warn, crit)
if returncode == 0: if returncode == 0:
output = 'No failed disks' output = 'No failed disks'
@ -199,8 +200,6 @@ class CheckNAF(SNMPMonitoringPlugin):
status = self.Status2String['df_FS_Status'].get(self.SNMPGET(self.OID['df_FS_Status'] + "." + idx)) status = self.Status2String['df_FS_Status'].get(self.SNMPGET(self.OID['df_FS_Status'] + "." + idx))
fstype = self.Status2String['df_FS_Type'].get(self.SNMPGET(self.OID['df_FS_Type'] + "." + idx)) fstype = self.Status2String['df_FS_Type'].get(self.SNMPGET(self.OID['df_FS_Type'] + "." + idx))
# print [mountedon, status, fstype]
fs_pctused = float(fs_used) / float(fs_total) * 100.0 fs_pctused = float(fs_used) / float(fs_total) * 100.0
warn = self.range_dehumanize(warn, fs_total) warn = self.range_dehumanize(warn, fs_total)
@ -322,12 +321,21 @@ def main():
while len(checks): while len(checks):
check = checks.pop() check = checks.pop()
target = None
arguments = None
if ':' in check:
target = ':'.join(check.split(':')[1:])
check = check.split(':')[0]
if ':' in target:
arguments = ':'.join(target.split(':')[1:])
target = target.split(':')[0]
if check == 'global': if check == 'global':
result = plugin.check_global() result = plugin.check_global()
elif check == 'cpu': elif check == 'cpu':
result = plugin.check_cpu() result = plugin.check_cpu()
elif check == 'disk': elif check == 'disk':
result = plugin.check_disk(target='spare') result = plugin.check_disk(target=target)
elif check == 'nvram': elif check == 'nvram':
result = plugin.check_nvram() result = plugin.check_nvram()
elif check == 'version': elif check == 'version':

View file

@ -150,7 +150,7 @@ class MonitoringPlugin(object):
perfdata += str(unit).lstrip().rstrip() perfdata += str(unit).lstrip().rstrip()
for key in ['warn', 'crit', 'min', 'max']: for key in ['warn', 'crit', 'min', 'max']:
perfdata += ';' perfdata += ';'
if key in kwargs: if key in kwargs and kwargs[key]!=None:
perfdata += str(kwargs[key]) perfdata += str(kwargs[key])
return perfdata return perfdata