1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-12-22 17:13:52 +01:00

Bugfix, no longer returns problem when not all powermodules are installed (thanks Davide Gandolfi)

This commit is contained in:
Pall Sigurdsson 2012-06-25 09:32:55 +00:00
parent bf9ecb7777
commit 38c56fe3d8

View File

@ -226,20 +226,24 @@ def check_powermodules():
status = 3
details = 4
num_ok = 0
num_no = 0
for i in powermodules.values():
myIndex = i[index]
myStatus = i[status]
myDetails = i[details]
myExists = i[exists]
if myIndex == opts.exclude: continue
if myStatus != "1":
nagios_status(warning)
add_summary( 'Powermodule "%s" status "%s". %s. ' % (myIndex,myStatus,myDetails) )
if myExists == "0":
num_no = num_no + 1
else:
num_ok = num_ok + 1
if myStatus != "1":
nagios_status(warning)
add_summary( 'Powermodule "%s" status "%s". %s. ' % (myIndex,myStatus,myDetails) )
else:
num_ok = num_ok + 1
add_long('Powersupply "%s" status "%s". %s. ' % (myIndex,myStatus,myDetails) )
add_summary( "%s out of %s powermodules are healthy" % (num_ok, len(powermodules) ) )
add_perfdata( "'Number of powermodules'=%s" % (len(powermodules) ) )
add_perfdata( "'Number of powermodules'=%s" % (len(powermodules) - num_no ) )
nagios_status(ok)