-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
414bd25
commit 8396eb0
Showing
11 changed files
with
978 additions
and
0 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_cache.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env python3 | ||
# -*- encoding: utf-8; py-indent-offset: 4 -*- | ||
|
||
# (c) 2017 Heinlein Support GmbH | ||
# Robert Sander <[email protected]> | ||
|
||
# | ||
# 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 | ||
], | ||
) | ||
) |
112 changes: 112 additions & 0 deletions
112
dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrfan.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env python3 | ||
# -*- encoding: utf-8; py-indent-offset: 4 -*- | ||
|
||
# (c) 2017 Heinlein Support GmbH | ||
# Robert Sander <[email protected]> | ||
|
||
# | ||
# 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 | ||
], | ||
) | ||
) |
82 changes: 82 additions & 0 deletions
82
dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrpower.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env python3 | ||
# -*- encoding: utf-8; py-indent-offset: 4 -*- | ||
|
||
# (c) 2017 Heinlein Support GmbH | ||
# Robert Sander <[email protected]> | ||
|
||
# | ||
# 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 | ||
], | ||
) | ||
) |
94 changes: 94 additions & 0 deletions
94
dell_sc/lib/python3/cmk_addons/plugins/dell/agent_based/dell_sc_ctlrtemp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env python3 | ||
# -*- encoding: utf-8; py-indent-offset: 4 -*- | ||
|
||
# (c) 2017 Heinlein Support GmbH | ||
# Robert Sander <[email protected]> | ||
|
||
# | ||
# 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 | ||
], | ||
) | ||
) |
Oops, something went wrong.