Module: check_mk
Branch: master
Commit: 89452dc34c3e3e367c33b03f063352b8abf2df0c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89452dc34c3e3e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jun 28 17:46:13 2012 +0200
apc_powerswitch: expaned functions
---
checks/apc_powerswitch | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/checks/apc_powerswitch b/checks/apc_powerswitch
index 8cdd920..4f9c08f 100644
--- a/checks/apc_powerswitch
+++ b/checks/apc_powerswitch
@@ -24,18 +24,27 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+apc_powerswitch_warning_states = (2,)
+apc_powerswitch_critical_states = ()
+
def inventory_apc_powerswitch(info):
return [(x[0],saveint(x[2])) for x in info]
def check_apc_powerswitch(item, params, info):
- state = {
+ state_name = {
1 : 'on',
2 : 'off',
}
+ r_state = 0
for line in info:
if line[0] == item:
- return(0, 'OK - Port %s has status %s' % (line[1],
state[saveint(line[2])]))
+ state = saveint(line[2])
+ if state in apc_powerswitch_warning_states:
+ r_state = 1
+ if state in apc_powerswitch_critical_states:
+ r_state = 2
+ return(r_state, nagios_state_names[r_state] + '- Port %s has status
%s' % (line[1], state_name[state]))
return False