diff --git a/dell_sc/dell_sc-3.3.1.mkp b/dell_sc/dell_sc-3.3.1.mkp new file mode 100644 index 00000000..ca9331a6 Binary files /dev/null and b/dell_sc/dell_sc-3.3.1.mkp differ diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_alert.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_alert.py new file mode 100644 index 00000000..01787ecd --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_alert.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.checkengine.checkresults import state_markers + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + State, + all_of, + contains, + exists, +) + + +def parse_dell_sc_alert(string_table): + print(string_table) + return {} + #return string_table + +def discover_dell_sc_alert(section): + yield Service() + +def check_dell_sc_alert(section): + state = { + 1 : ('complete', State.OK), + 2 : ('critical', State.CRIT), + 3 : ('degraded', State.WARN), + 4 : ('down', State.CRIT), + 5 : ('emergency', State.CRIT), + 6 : ('inform', State.OK), + 7 : ('okay', State.OK), + 8 : ('unavailable', State.CRIT), + 9 : ('unknown', State.UNKNOWN), + } + category = { + 0 : 'connectivity', + 1 : 'disk', + 2 : 'hardware', + 3 : 'storage', + 4 : 'system', + 5 : 'unknown', + } + atype = { + 0 : 'alert', + 1 : 'indication', + 2 : 'unknown', + } + + alerts = [] + res = State.OK + for nbr, istate, definition, icat, ctime, message, itype, ack, act in section: + if act == "1" and ack == "2": + alert_state = state.get(int(istate), ('unknown', State.UNKNOWN)) + if int(alert_state[1]) > int(res): + res = alert_state[1] + alerts.append("%s %s %s on %s: %s%s" % ( + alert_state[0], + category.get(int(icat), 'unknown'), + definition, + ctime, + message, + state_markers[int(alert_state[1])])) + + if not alerts: + alerts = ['No Alerts'] + + yield Result(state=res, summary="%s" % alerts[0], details="%s\n%s" % (alerts[0],"\n".join(alerts[1:]))) + + +check_plugin_dell_sc_alert = CheckPlugin( + name="dell_sc_alert", + sections = [ "dell_sc_alert" ], + service_name="Dell SC Alert", + discovery_function=discover_dell_sc_alert, + check_function=check_dell_sc_alert, +) + + +snmp_section_dell_sc_alert = SimpleSNMPSection( + name = "dell_sc_alert", + parse_function = parse_dell_sc_alert, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.46.1', + oids = [ + '2', # scAlertNbr + '3', # scAlertStatus + '5', # scAlertDefinition + '6', # scAlertCategory + '7', # scAlertCreateTime + '8', # scAlertMessage + '9', # scAlertType + '10', # scAlertAcknowledged + '11', # scAlertActive + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_cache.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_cache.py new file mode 100644 index 00000000..cccc3649 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_cache.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + State, + all_of, + contains, + exists, +) + + +def parse_dell_sc_cache(string_table): + return string_table + +def discover_dell_sc_cache(section): + for line in section: + name=line[0] + yield Service(item=name) + +def check_dell_sc_cache(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + batt = { + 0 : 'no battery', + 1 : 'normal', + 2 : 'expiration pending', + 3 : 'expired', + } + + for line in section: + if line[0] == item: + cache_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + + yield Result(state=cache_state[1], summary="%s, Battery Expiration: %s (%s), State is %s" % ( + line[2], + line[4], + batt.get(int(line[3]), line[3]), + cache_state[0]) + ) + + +check_plugin_dell_sc_cache = CheckPlugin( + name="dell_sc_cache", + sections = [ "dell_sc_cache" ], + service_name="Dell SC Cache %s", + discovery_function=discover_dell_sc_cache, + check_function=check_dell_sc_cache, +) + + +snmp_section_dell_sc_cache = SimpleSNMPSection( + name = "dell_sc_cache", + parse_function = parse_dell_sc_cache, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1', + oids = [ + '2', # scCacheNbr + '3', # scCacheStatus + '4', # scCacheName + '5', # scCacheBatStat + '6', # scCacheBatExpr + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrfan.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrfan.py new file mode 100644 index 00000000..3791ceda --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrfan.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.plugins.lib.fan import check_fan + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_ctlrfan(line): + ctlr, fan = line[0].split('.') + return "Ctlr %s Fan %s" % (ctlr, fan) + +def parse_dell_sc_ctlrfan(string_table): + return string_table + +def discover_dell_sc_ctlrfan(section): + for line in section: + name = item_dell_sc_ctlrfan(line) + yield Service(item=name) + +def check_dell_sc_ctlrfan(item, params, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_ctlrfan(line) == item: + ctlrfan_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + rpm = int(line[3] or 0) + norm_max = int(line[4]) if line[4] else None + norm_min = int(line[5]) if line[5] else None + warn_lower = int(line[6]) if line[6] else None + warn_upper = int(line[7]) if line[7] else None + crit_lower = int(line[8]) if line[8] else None + crit_upper = int(line[9]) if line[9] else None + + params_local = dict(params) + if "lower" not in params and (warn_lower is not None and crit_lower is not None): + params_local["lower"] = (warn_lower, crit_lower) + if "upper" not in params and (warn_upper is not None and crit_upper is not None): + params_local["upper"] = (warn_upper, crit_upper) + + yield from check_fan(rpm, params_local) + if norm_max is not None and norm_min is not None: + yield Result(state=State.OK, summary="Range: %d/%d" % (norm_min, norm_max)) + yield Result(state=ctlrfan_state[1], summary="State is %s" % ctlrfan_state[0]) + + +check_plugin_dell_sc_ctlrfan = CheckPlugin( + name="dell_sc_ctlrfan", + sections = [ "dell_sc_ctlrfan" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_ctlrfan, + check_function=check_dell_sc_ctlrfan, + check_default_parameters={ + "output_metrics": True + }, + check_ruleset_name="hw_fans", +) + + +snmp_section_dell_sc_ctlrfan = SimpleSNMPSection( + name = "dell_sc_ctlrfan", + parse_function = parse_dell_sc_ctlrfan, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1', + oids = [ + OIDEnd(), # scCtlrFanNbr + '3', # scCtlrFanStatus + '4', # scCtlrFanName + '5', # scCtlrFanCurrentRpm + '6', # scCtlrFanNormMaxRpm + '7', # scCtlrFanNormMinRpm + '8', # scCtlrFanWarnLwrRpm + '9', # scCtlrFanWarnUprRpm + '10', # scCtlrFanCritLwrRpm + '11', # scCtlrFanCritUprRpm + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrpower.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrpower.py new file mode 100644 index 00000000..ce24bdc9 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrpower.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_ctlrpower(line): + encl, power = line[0].split('.') + return "Ctlr %s Power %s" % (encl, power) + +def parse_dell_sc_ctlrpower(string_table): + return string_table + +def discover_dell_sc_ctlrpower(section): + for line in section: + name = item_dell_sc_ctlrpower(line) + yield Service(item=name) + +def check_dell_sc_ctlrpower(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_ctlrpower(line) == item: + ctlrpower_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=ctlrpower_state[1], summary="State is %s" % ctlrpower_state[0]) + + +check_plugin_dell_sc_ctlrpower = CheckPlugin( + name="dell_sc_ctlrpower", + sections = [ "dell_sc_ctlrpower" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_ctlrpower, + check_function=check_dell_sc_ctlrpower, +) + + +snmp_section_dell_sc_ctlrpower = SimpleSNMPSection( + name = "dell_sc_ctlrpower", + parse_function = parse_dell_sc_ctlrpower, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1', + oids = [ + OIDEnd(), # scCtlrPowerNbr + '3', # scCtlrPowerStatus + '4', # scCtlrPowerName + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrtemp.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrtemp.py new file mode 100644 index 00000000..0498099f --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrtemp.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + +from cmk.plugins.lib.temperature import check_temperature + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_ctlrtemp(line): + ctlr, temp = line[0].split('.') + return "Ctlr %s Temp %s" % (ctlr, temp) + +def parse_dell_sc_ctlrtemp(string_table): + return string_table + +def discover_dell_sc_ctlrtemp(section): + for line in section: + name = item_dell_sc_ctlrtemp(line) + yield Service(item=name) + +def check_dell_sc_ctlrtemp(item, params, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_ctlrtemp(line) == item: + ctlrtemp_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + temp = int(line[3] or 0) + yield from check_temperature( + reading=temp, + params=params, + #unique_name="dell_sc_ctlrtemp%s" % item, + #value_store=value_store, + ) + yield Result(state=ctlrtemp_state[1], summary="State is %s" % ctlrtemp_state[0]) + + +check_plugin_dell_sc_ctlrtemp = CheckPlugin( + name="dell_sc_ctlrtemp", + sections = [ "dell_sc_ctlrtemp" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_ctlrtemp, + check_function=check_dell_sc_ctlrtemp, + check_default_parameters={ + }, + check_ruleset_name="temperature", +) + + +snmp_section_dell_sc_ctlrtemp = SimpleSNMPSection( + name = "dell_sc_ctlrtemp", + parse_function = parse_dell_sc_ctlrtemp, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1', + oids = [ + OIDEnd(), # ctlr + temp + '3', # scCtlrTempStatus + '4', # scCtlrTempName + '5', # scCtlrTempCurrentC + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_enclfan.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_enclfan.py new file mode 100644 index 00000000..5d74da53 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_enclfan.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_enclfan(line): + encl, fan = line[0].split('.') + return "Encl %s Fan %s" % (encl, fan) + +def parse_dell_sc_enclfan(string_table): + return string_table + +def discover_dell_sc_enclfan(section): + for line in section: + name = item_dell_sc_enclfan(line) + yield Service(item=name) + +def check_dell_sc_enclfan(item, params, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_enclfan(line) == item: + enclfan_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=enclfan_state[1], summary="%s, Speed is %s, State is %s" % (line[2],line[3],enclfan_state[0])) + + +check_plugin_dell_sc_enclfan = CheckPlugin( + name="dell_sc_enclfan", + sections = [ "dell_sc_enclfan" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_enclfan, + check_function=check_dell_sc_enclfan, + check_default_parameters={ + 'lower' : (1000, 100), + "output_metrics": True + }, +) + + +snmp_section_dell_sc_enclfan = SimpleSNMPSection( + name = "dell_sc_enclfan", + parse_function = parse_dell_sc_enclfan, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1', + oids = [ + OIDEnd(), # encl + fan + '3', # scEnclFanStatus + '4', # scEnclFanLocation + '5', # scEnclFanCurrentS + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_encltemp.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_encltemp.py new file mode 100644 index 00000000..98d8acfe --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_encltemp.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + +from cmk.plugins.lib.temperature import check_temperature + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_encltemp(line): + encl, temp = line[0].split('.') + return "Encl %s Temp %s" % (encl, temp) + +def parse_dell_sc_encltemp(string_table): + return string_table + +def discover_dell_sc_encltemp(section): + for line in section: + name = item_dell_sc_encltemp(line) + yield Service(item=name) + +def check_dell_sc_encltemp(item, params, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_encltemp(line) == item: + encltemp_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + temp = int(line[3] or 0) + yield from check_temperature( + reading=temp, + params=params, + #unique_name="dell_sc_encltemp_%s" % item, + #value_store=value_store, + ) + yield Result(state=encltemp_state[1], summary="State is %s" % encltemp_state[0]) + + +check_plugin_dell_sc_encltemp = CheckPlugin( + name="dell_sc_encltemp", + sections = [ "dell_sc_encltemp" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_encltemp, + check_function=check_dell_sc_encltemp, + check_default_parameters={ + }, + check_ruleset_name="temperature", +) + + +snmp_section_dell_sc_encltemp = SimpleSNMPSection( + name = "dell_sc_encltemp", + parse_function = parse_dell_sc_encltemp, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1', + oids = [ + OIDEnd(), # scEnclTempNbr + '3', # scEnclTempStatus + '4', # scEnclTempLocation + '5', # scEnclTempCurrentC + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_iomod.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_iomod.py new file mode 100644 index 00000000..b1fda560 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_iomod.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_iomod(line): + encl, iomod = line[0].split('.') + return "Encl %s IOmod %s" % (encl, iomod) + +def parse_dell_sc_iomod(string_table): + return string_table + +def discover_dell_sc_iomod(section): + for line in section: + name = item_dell_sc_iomod(line) + yield Service(item=name) + +def check_dell_sc_iomod(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_iomod(line) == item: + iomod_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=iomod_state[1], summary="%s, State is %s" % (line[2],iomod_state[0])) + + +check_plugin_dell_sc_iomod = CheckPlugin( + name="dell_sc_iomod", + sections = [ "dell_sc_iomod" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_iomod, + check_function=check_dell_sc_iomod, +) + + +snmp_section_dell_sc_iomod = SimpleSNMPSection( + name = "dell_sc_iomod", + parse_function = parse_dell_sc_iomod, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1', + oids = [ + OIDEnd(), # scEnclIoModNbr + '3', # scEnclIoModStatus + '4', # scEnclIoModPosition + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_power.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_power.py new file mode 100644 index 00000000..6410182a --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_power.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + OIDEnd, + State, + all_of, + contains, + exists, +) + + +def item_dell_sc_power(line): + encl, power = line[0].split('.') + return "Encl %s Power %s" % (encl, power) + +def parse_dell_sc_power(string_table): + return string_table + +def discover_dell_sc_power(section): + for line in section: + name = item_dell_sc_power(line) + yield Service(item=name) + +def check_dell_sc_power(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if item_dell_sc_power(line) == item: + power_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=power_state[1], summary="State is %s" % power_state[0]) + + +check_plugin_dell_sc_power = CheckPlugin( + name="dell_sc_power", + sections = [ "dell_sc_power" ], + service_name="Dell SC %s", + discovery_function=discover_dell_sc_power, + check_function=check_dell_sc_power, +) + + +snmp_section_dell_sc_power = SimpleSNMPSection( + name = "dell_sc_power", + parse_function = parse_dell_sc_power, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1', + oids = [ + OIDEnd(), # Encl + Power + '3', # scEnclPowerStatus + '4', # scEnclPowerPosition + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_server.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_server.py new file mode 100644 index 00000000..8913e6b0 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_server.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + State, + all_of, + contains, + exists, +) + + +def parse_dell_sc_server(string_table): + return string_table + +def discover_dell_sc_server(section): + for line in section: + name=line[0] + yield Service(item=name) + +def check_dell_sc_server(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + conn = { + 1 : 'up', + 2 : 'down', + 3 : 'partial', + } + for line in section: + if line[0] == item: + server_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=server_state[1], summary="%s, Number of Paths: %s, Connectivity %s, State is %s" % ( + line[2], + line[4], + conn.get(int(line[3]), line[3]), + server_state[0]) + ) + + +check_plugin_dell_sc_server = CheckPlugin( + name="dell_sc_server", + sections = [ "dell_sc_server" ], + service_name="Dell SC Server %s", + discovery_function=discover_dell_sc_server, + check_function=check_dell_sc_server, +) + + +snmp_section_dell_sc_server = SimpleSNMPSection( + name = "dell_sc_server", + parse_function = parse_dell_sc_server, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1', + oids = [ + '2', # scServerNbr + '3', # scServerStatus + '4', # scServerName + '5', # scServerCnctvy + '6', # scServerPathCount + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_sysinfo.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_sysinfo.py new file mode 100644 index 00000000..850fb209 --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_sysinfo.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + State, + all_of, + contains, + exists, +) + + +def parse_dell_sc_sysinfo(string_table): + return string_table + +def discover_dell_sc_sysinfo(section): + yield Service() + +def check_dell_sc_sysinfo(section): + state = { + 1 : ('Other', State.UNKNOWN), + 2 : ('Unknown', State.UNKNOWN), + 3 : ('OK', State.OK), + 4 : ('non Critical', State.WARN), + 5 : ('Critical', State.CRIT), + 6 : ('non Recoverable', State.CRIT), + } + + version = section[0][0] + servicetag = section[0][1] + build = section[0][3] + globalState = state.get(int(section[0][2]), ('Unknown', 3)) + + yield Result(state=globalState[1], summary="Version %s, ServiceTag %s, Build %s, State %s" % ( + version, + servicetag, + build, + globalState[0]) + ) + + +check_plugin_dell_sc_sysinfo = CheckPlugin( + name="dell_sc_sysinfo", + sections = [ "dell_sc_sysinfo" ], + service_name="Dell SC SysInfo", + discovery_function=discover_dell_sc_sysinfo, + check_function=check_dell_sc_sysinfo, +) + + +snmp_section_dell_sc_sysinfo = SimpleSNMPSection( + name = "dell_sc_sysinfo", + parse_function = parse_dell_sc_sysinfo, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2', + oids = [ + '4.0', # productIDVersion + '5.0', # productIDSerialNumber + '6.0', # productIDGlobalStatus + '7.0', # productIDBuildNumber + ], + ) +) diff --git a/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_volume.py b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_volume.py new file mode 100644 index 00000000..44e1b1ab --- /dev/null +++ b/dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_volume.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +# -*- encoding: utf-8; py-indent-offset: 4 -*- + +# (c) 2017 Heinlein Support GmbH +# Robert Sander + +# +# This 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. + + +from cmk.agent_based.v2 import ( + CheckPlugin, + Service, + Result, + SimpleSNMPSection, + SNMPTree, + State, + all_of, + contains, + exists, +) + + +def parse_dell_sc_volume(string_table): + return string_table + +def discover_dell_sc_volume(section): + for line in section: + name = line[0] + yield Service(item=name) + +def check_dell_sc_volume(item, section): + state = { + 1 : ('up', State.OK), + 2 : ('down', State.CRIT), + 3 : ('degraded', State.WARN), + } + for line in section: + if line[0] == item: + volume_state = state.get(int(line[1]), ('unknown', State.UNKNOWN)) + yield Result(state=volume_state[1], summary="%s, State is %s" % (line[2],volume_state[0])) + + +check_plugin_dell_sc_volume = CheckPlugin( + name="dell_sc_volume", + sections = [ "dell_sc_volume" ], + service_name="Dell SC Volume %s", + discovery_function=discover_dell_sc_volume, + check_function=check_dell_sc_volume, +) + + +snmp_section_dell_sc_volume = SimpleSNMPSection( + name = "dell_sc_volume", + parse_function = parse_dell_sc_volume, + detect = all_of( + contains(".1.3.6.1.2.1.1.1.0", "compellent"), + exists(".1.3.6.1.4.1.674.11000.2000.500.1.2.1.0"), + ), + fetch = SNMPTree( + base = '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1', + oids = [ + '2', # scVolumeNbr + '3', # scVolumeStatus + '4', # scVolumeName + ], + ) +)