added checks
This commit is contained in:
parent
38f7bd5f3c
commit
dc5087f3eb
61
flex_blade_bays
Normal file
61
flex_blade_bays
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# SpearHead Systems
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
flex_blade_bays_module_state = {
|
||||||
|
0: 'standby',
|
||||||
|
1: 'on',
|
||||||
|
2: 'notPresent',
|
||||||
|
255: 'notApplicable',
|
||||||
|
}
|
||||||
|
|
||||||
|
def flex_blade_bays_make_item(line):
|
||||||
|
# "3.IO Module 5"
|
||||||
|
pd, name = line[0].split(".", 1)
|
||||||
|
if pd == '2':
|
||||||
|
power_domain = 1
|
||||||
|
else:
|
||||||
|
power_domain = 2
|
||||||
|
return "PD%d %s" % (power_domain, name)
|
||||||
|
|
||||||
|
def inventory_flex_blade_bays(info):
|
||||||
|
# find only modules that are present and switched on or standby
|
||||||
|
inventory = []
|
||||||
|
for line in info:
|
||||||
|
if line[1] in [ '0', '1' ]:
|
||||||
|
item = flex_blade_bays_make_item(line)
|
||||||
|
inventory.append((item, None))
|
||||||
|
return inventory
|
||||||
|
|
||||||
|
def check_flex_blade_bays(item, _no_params, info):
|
||||||
|
for line in info:
|
||||||
|
if item == flex_blade_bays_make_item(line):
|
||||||
|
state = saveint(line[1])
|
||||||
|
type = line[2].split('(')[0]
|
||||||
|
if state == 1:
|
||||||
|
return (0, "State %s (Type: %s, ID: %s)" %
|
||||||
|
(flex_blade_bays_module_state.get(state, 'Unhandled'), type, line[3]))
|
||||||
|
elif state == 2:
|
||||||
|
return (1, "Not present")
|
||||||
|
elif state == 3:
|
||||||
|
return (1, "Device is switched off")
|
||||||
|
elif state == 0:
|
||||||
|
return (1, "Device is in standby")
|
||||||
|
else:
|
||||||
|
return (2, "invalid state %d" % state)
|
||||||
|
return (3, "no data for '%s' in SNMP info" % item)
|
||||||
|
|
||||||
|
check_info["flex_blade_bays"] = {
|
||||||
|
'check_function': check_flex_blade_bays,
|
||||||
|
'inventory_function': inventory_flex_blade_bays,
|
||||||
|
'service_description': 'IBM Flex Bay %s',
|
||||||
|
'snmp_info': (
|
||||||
|
".1.3.6.1.4.1.2.3.51.2.2.10", [
|
||||||
|
"2", # powerDomain1
|
||||||
|
"3", # powerDomain2
|
||||||
|
], [ "1.1.5", "1.1.6", "1.1.2", "1.1.1" ] ), # BLADE-MIB
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
83
flex_blade_blades
Normal file
83
flex_blade_blades
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
#
|
||||||
|
# This file is part of Check_MK.
|
||||||
|
# The official homepage is at http://mathias-kettner.de/check_mk.
|
||||||
|
#
|
||||||
|
# check_mk is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation in version 2. check_mk is distributed
|
||||||
|
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
|
||||||
|
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
|
||||||
|
# ails. You should have received a copy of the GNU General Public
|
||||||
|
# License along with GNU Make; see the file COPYING. If not, write
|
||||||
|
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
# Author: Lars Michelsen <lm@mathias-kettner.de>
|
||||||
|
|
||||||
|
# Mappings for translating SNMP states to nagios states
|
||||||
|
flex_blade_blades_exists_states = (2, 0)
|
||||||
|
flex_blade_blades_power_states = (1, 0)
|
||||||
|
flex_blade_blades_health_states = (3, 0, 1, 2)
|
||||||
|
|
||||||
|
# Name mappings
|
||||||
|
flex_blade_blades_exists_labels = ('no', 'yes')
|
||||||
|
flex_blade_blades_power_labels = ('off', 'on')
|
||||||
|
flex_blade_blades_health_labels = ('unknown', 'good', 'warning', 'bad')
|
||||||
|
|
||||||
|
def inventory_flex_blade_blades(info):
|
||||||
|
# find only blades that are powered on
|
||||||
|
return [ (line[0], '', line[1]) for line in info if line[2] == '1' ]
|
||||||
|
|
||||||
|
def check_flex_blade_blades(item, params, info):
|
||||||
|
for line in info:
|
||||||
|
if line[0] == item:
|
||||||
|
exists, power_state, health_state = map(saveint, line[1:4])
|
||||||
|
name = line[4]
|
||||||
|
|
||||||
|
state = 0
|
||||||
|
output = '%s: ' % (name)
|
||||||
|
|
||||||
|
for label, part_state, nag_state, state_label in (
|
||||||
|
('Exists', exists, flex_blade_blades_exists_states[exists], flex_blade_blades_exists_labels[exists]),
|
||||||
|
('Power', power_state, flex_blade_blades_power_states[power_state], flex_blade_blades_power_labels[power_state]),
|
||||||
|
('Health', health_state, flex_blade_blades_health_states[health_state], flex_blade_blades_health_labels[health_state])):
|
||||||
|
output += '%s: %s' % (label, state_label)
|
||||||
|
if nag_state == 1:
|
||||||
|
output += ' (!)'
|
||||||
|
elif nag_state == 2:
|
||||||
|
output += ' (!!)'
|
||||||
|
elif nag_state == 3:
|
||||||
|
output += ' (UNKNOWN)'
|
||||||
|
state = max(state, nag_state)
|
||||||
|
output += ', '
|
||||||
|
|
||||||
|
return (state, output.rstrip(', '))
|
||||||
|
return (3, "no data for '%s' in SNMP info" % item)
|
||||||
|
|
||||||
|
check_info["flex_blade_blades"] = {
|
||||||
|
'check_function': check_flex_blade_blades,
|
||||||
|
'inventory_function': inventory_flex_blade_blades,
|
||||||
|
'service_description': 'Flex Blade %s',
|
||||||
|
'snmp_info': (
|
||||||
|
".1.3.6.1.4.1.2.3.51.2.22.1.5.1.1", [ # BLADE-MIB
|
||||||
|
2, # bladeId
|
||||||
|
3, # bladeExists
|
||||||
|
4, # bladePowerState
|
||||||
|
5, # bladeHealthState
|
||||||
|
6, # bladeName
|
||||||
|
]),
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
89
flex_blade_blowers
Normal file
89
flex_blade_blowers
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
|
||||||
|
# SpearHead Systems
|
||||||
|
|
||||||
|
# The BLADE-MIB is somewhat goofy redarding the blower
|
||||||
|
# information. The blowers are listed sequentially
|
||||||
|
# below the same subtrees:
|
||||||
|
|
||||||
|
# BLADE-MIB::blower1speed.0 = STRING: "50% of maximum"
|
||||||
|
# BLADE-MIB::blower2speed.0 = STRING: "50% of maximum"
|
||||||
|
# BLADE-MIB::blower1State.0 = INTEGER: good(1)
|
||||||
|
# BLADE-MIB::blower2State.0 = INTEGER: good(1)
|
||||||
|
# BLADE-MIB::blowers.20.0 = STRING: "1712"
|
||||||
|
# BLADE-MIB::blowers.21.0 = STRING: "1696"
|
||||||
|
# BLADE-MIB::blowers.30.0 = INTEGER: 0
|
||||||
|
# BLADE-MIB::blowers.31.0 = INTEGER: 0
|
||||||
|
#
|
||||||
|
# The same with -On:
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.1.0 = STRING: "49% of maximum"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.2.0 = STRING: "No Blower"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.10.0 = INTEGER: good(1)
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.11.0 = INTEGER: unknown(0)
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.20.0 = STRING: "1696"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.21.0 = STRING: "No Blower"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.30.0 = INTEGER: 0
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.3.31.0 = INTEGER: 2
|
||||||
|
#
|
||||||
|
# How can we safely determine the number of blowers without
|
||||||
|
# assuming that each blower has four entries?
|
||||||
|
|
||||||
|
# We assume that all blowers are in state OK (used for
|
||||||
|
# inventory only)
|
||||||
|
def number_of_flex_blowers(info):
|
||||||
|
n = 0
|
||||||
|
while len(info) > n and len(info[n][0]) > 1: # state lines
|
||||||
|
n += 1
|
||||||
|
return n
|
||||||
|
|
||||||
|
def inventory_flex_blade_blowers(info):
|
||||||
|
inventory = []
|
||||||
|
n = number_of_flex_blowers(info)
|
||||||
|
for i in range(0, n):
|
||||||
|
if info[i + n][0] != "0": # skip unknown blowers
|
||||||
|
inventory.append( ("%d/%d" % (i+1,n), None, None) )
|
||||||
|
return inventory
|
||||||
|
|
||||||
|
def check_flex_blade_blowers(item, _no_params, info):
|
||||||
|
blower, num_flex_blowers = map(int, item.split("/"))
|
||||||
|
text = info[blower-1][0]
|
||||||
|
perfdata = []
|
||||||
|
output = ''
|
||||||
|
|
||||||
|
state = info[blower-1 + num_blowers][0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
rpm = int(info[blower-1 + 2*num_blowers][0])
|
||||||
|
perfdata += [("rpm", rpm)]
|
||||||
|
output += 'Flex Speed at %d RMP' % rpm
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
perc = int(text.split("%")[0])
|
||||||
|
perfdata += [("perc", perc, None, None, 0, 100)]
|
||||||
|
if output == '':
|
||||||
|
output += 'Flex Speed is at %d%% of max' % perc
|
||||||
|
else:
|
||||||
|
output += ' (%d%% of max)' % perc
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if state == "1":
|
||||||
|
return (0, output, perfdata)
|
||||||
|
else:
|
||||||
|
return (2, output, perfdata)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["flex_blade_blowers"] = {
|
||||||
|
'check_function': check_flex_blade_blowers,
|
||||||
|
'inventory_function': inventory_flex_blade_blowers,
|
||||||
|
'service_description': 'IBM Flex Blower %s',
|
||||||
|
'has_perfdata': True,
|
||||||
|
'snmp_info': ('.1.3.6.1.4.1.2.3.51.2.2', [3]),
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
42
flex_blade_health
Normal file
42
flex_blade_health
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# SpearHead Systems
|
||||||
|
#
|
||||||
|
|
||||||
|
# Example excerpt from SNMP data:
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.7.1.0 255
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.7.2.1.1.1 1
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.7.2.1.2.1 "Good"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.7.2.1.3.1 "No critical or warning events"
|
||||||
|
# .1.3.6.1.4.1.2.3.51.2.2.7.2.1.4.1 "No timestamp"
|
||||||
|
|
||||||
|
|
||||||
|
def inventory_flex_blade_health(info):
|
||||||
|
if len(info) == 1:
|
||||||
|
return [(None, None, None)]
|
||||||
|
|
||||||
|
def check_flex_blade_health(_no_item, _no_params, info):
|
||||||
|
state = info[0][0]
|
||||||
|
descr = ": " + ", ".join([ line[1] for line in info if len(line) > 1 ])
|
||||||
|
|
||||||
|
if state == "255":
|
||||||
|
return (0, "State is good")
|
||||||
|
elif state == "2":
|
||||||
|
return (2, "State is degraded (non critical)" + descr)
|
||||||
|
elif state == "4":
|
||||||
|
return (1, "State is degraded (system level)" + descr)
|
||||||
|
elif state == "0":
|
||||||
|
return (2, "State is critical!" + descr)
|
||||||
|
else:
|
||||||
|
return (3, "Undefined state code %s%s" % (state, descr))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["flex_blade_health"] = {
|
||||||
|
'check_function': check_flex_blade_health,
|
||||||
|
'inventory_function': inventory_flex_blade_health,
|
||||||
|
'service_description': 'IBM Flex Summary health state',
|
||||||
|
'snmp_info': ('.1.3.6.1.4.1.2.3.51.2.2.7', ['1.0', '2.1.3.1']),
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
63
flex_blade_powerfan
Normal file
63
flex_blade_powerfan
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
# | ____ _ _ __ __ _ __ |
|
||||||
|
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
|
||||||
|
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
|
||||||
|
# | | |___| | | | __/ (__| < | | | | . \ |
|
||||||
|
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
|
||||||
|
# | |
|
||||||
|
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
|
||||||
|
# +------------------------------------------------------------------+
|
||||||
|
#
|
||||||
|
# This file is part of Check_MK.
|
||||||
|
# The official homepage is at http://mathias-kettner.de/check_mk.
|
||||||
|
#
|
||||||
|
# check_mk is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation in version 2. check_mk is distributed
|
||||||
|
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
|
||||||
|
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
|
||||||
|
# ails. You should have received a copy of the GNU General Public
|
||||||
|
# License along with GNU Make; see the file COPYING. If not, write
|
||||||
|
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
# Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
|
||||||
|
def inventory_flex_blade_powerfan(info):
|
||||||
|
return [ (line[0], '(50, 60)') for line in info if line[0] != '' and line[1] == '1' ]
|
||||||
|
|
||||||
|
def check_flex_blade_powerfan(item, params, info):
|
||||||
|
warn_perc, crit_perc = params
|
||||||
|
for index, present, status, fancount, speedperc, rpm, ctrlstate in info:
|
||||||
|
if index != item: continue
|
||||||
|
perfdata=[ ('perc', speedperc, warn_perc, crit_perc, "0", "100" ),
|
||||||
|
('rpm', rpm ) ]
|
||||||
|
speedperc_int = saveint(speedperc)
|
||||||
|
if present != "1":
|
||||||
|
return (2, "Fan not present", perfdata)
|
||||||
|
elif status != "1":
|
||||||
|
return (2, "Status not OK", perfdata)
|
||||||
|
elif ctrlstate != "0":
|
||||||
|
return (2, "Controller state not OK", perfdata)
|
||||||
|
elif speedperc <= crit_perc:
|
||||||
|
return (2, "Speed at %d%% of max (crit at %d%%)" % (speedperc_int, crit_perc), perfdata)
|
||||||
|
elif speedperc <= warn_perc:
|
||||||
|
return (1, "Speed at %d%% of max (warning at %d%%)" % (speedperc_int, warn_perc), perfdata)
|
||||||
|
else:
|
||||||
|
return (0, "Speed at %s RPM (%d%% of max)" % (rpm, speedperc_int), perfdata)
|
||||||
|
|
||||||
|
return (3, "Device %s not found in SNMP data" % item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["flex_blade_powerfan"] = {
|
||||||
|
'check_function': check_flex_blade_powerfan,
|
||||||
|
'inventory_function': inventory_flex_blade_powerfan,
|
||||||
|
'service_description': 'IBM Flex Power Module Cooling Device %s',
|
||||||
|
'has_perfdata': True,
|
||||||
|
'snmp_info': ('.1.3.6.1.4.1.2.3.51.2.2.6.1.1', [1, 2, 3, 4, 5, 6, 7]),
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
31
flex_blade_powermod
Normal file
31
flex_blade_powermod
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8; py-indent-offset: 4 -*-
|
||||||
|
# SpearHead Systems
|
||||||
|
#
|
||||||
|
|
||||||
|
def inventory_flex_blade_powermod(info):
|
||||||
|
return [ (line[0], '', '""') for line in info if line[1] == '1' ]
|
||||||
|
|
||||||
|
def check_flex_blade_powermod(index, _no_param, info):
|
||||||
|
for line in info:
|
||||||
|
if line[0] == index:
|
||||||
|
present, status, text = line[1:]
|
||||||
|
if present != "1":
|
||||||
|
return (2, "Not present")
|
||||||
|
elif status != "1":
|
||||||
|
return (2, "%s" % text)
|
||||||
|
else:
|
||||||
|
return (0, "%s" % text)
|
||||||
|
return (3, "Module %s not found in SNMP info" % index)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["flex_blade_powermod"] = {
|
||||||
|
'check_function': check_flex_blade_powermod,
|
||||||
|
'inventory_function': inventory_flex_blade_powermod,
|
||||||
|
'service_description': 'IBM Flex Power Module %s',
|
||||||
|
'snmp_info': ('.1.3.6.1.4.1.2.3.51.2.2.4.1.1', [1, 2, 3, 4]),
|
||||||
|
'snmp_scan_function': \
|
||||||
|
lambda oid: re.match('IBM Flex Chassis Management Module', oid(".1.3.6.1.2.1.1.1.0")) != None,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user