added scality ring developed check
This commit is contained in:
parent
0f60e5725e
commit
b3a43a96b1
9
check_mk-scality-ring/README.MD
Normal file
9
check_mk-scality-ring/README.MD
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
This plugin monitors Scality Ring Supervisor through SNMP.
|
||||||
|
New checks added:
|
||||||
|
Ring Disks: Monitors the number of disks per ring. Parameters can be set for warn/crit if the number of disks reported is below a value.
|
||||||
|
|
||||||
|
Ring Stage: Monitors the Ring Status. If the ring is not in Run State, service will be CRIT.
|
||||||
|
|
||||||
|
Ring Storage: Storage used per Ring. Parameters can be set and the general filesystem parameters are used.
|
||||||
|
|
||||||
|
Supervisor Status: Monitors the supervisor status and server status. If the supervisor is not available or any of the servers are not OK, the service goes CRIT.
|
BIN
check_mk-scality-ring/ScalityRing-1.0.1.mkp
Normal file
BIN
check_mk-scality-ring/ScalityRing-1.0.1.mkp
Normal file
Binary file not shown.
167
check_mk-scality-ring/local/share/check_mk/checks/scality
Normal file
167
check_mk-scality-ring/local/share/check_mk/checks/scality
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
|
||||||
|
# NOTE: Careful when replacing the *-import below with a more specific import. This can cause
|
||||||
|
# problems because it might remove variables from the check-context which are necessary for
|
||||||
|
# resolving legacy discovery results such as [("SUMMARY", "diskstat_default_levels")]. Furthermore,
|
||||||
|
# it might also remove variables needed for accessing discovery rulesets.
|
||||||
|
#from cmk.base.check_legacy_includes.cisco_sensor_item import * # pylint: disable=wildcard-import,unused-wildcard-import
|
||||||
|
|
||||||
|
|
||||||
|
def inventory_scality_disk(info):
|
||||||
|
for line in info[0]:
|
||||||
|
yield (line[0],{})
|
||||||
|
|
||||||
|
def check_scality_disk(item, params, info):
|
||||||
|
if params.get("disks"):
|
||||||
|
warn, crit = params["disks"]
|
||||||
|
for line in info[0]:
|
||||||
|
if item in line:
|
||||||
|
ringdisktotal = int(line[3])
|
||||||
|
perfdata = [("Disks", ringdisktotal)]
|
||||||
|
infotext = "Number of disks: %s. " %ringdisktotal
|
||||||
|
if ringdisktotal <= warn:
|
||||||
|
if ringdisktotal <= crit:
|
||||||
|
infotext += "This is lower or equal with %s, critical level" %crit
|
||||||
|
yield 2, infotext, perfdata
|
||||||
|
else:
|
||||||
|
infotext += "This is lower or equal with %s, warning level" %warn
|
||||||
|
yield 1, infotext, perfdata
|
||||||
|
else:
|
||||||
|
yield 0, infotext, perfdata
|
||||||
|
|
||||||
|
else:
|
||||||
|
for line in info[0]:
|
||||||
|
if item in line:
|
||||||
|
ringdisktotal = line[3]
|
||||||
|
perfdata = [("Disks", ringdisktotal)]
|
||||||
|
infotext = "Number of disks: %s" %ringdisktotal
|
||||||
|
yield 0, infotext, perfdata
|
||||||
|
|
||||||
|
check_info["scality_ring.disk"] = {
|
||||||
|
"check_function": check_scality_disk,
|
||||||
|
"inventory_function": inventory_scality_disk,
|
||||||
|
"service_description": "Ring %s Disks",
|
||||||
|
"has_perfdata": True,
|
||||||
|
"group": "scality_disks"
|
||||||
|
}
|
||||||
|
##############RING STATUS############
|
||||||
|
def inventory_scality_supervisor(info):
|
||||||
|
for line in info[1]:
|
||||||
|
yield (line[0],{})
|
||||||
|
|
||||||
|
def check_scality_supervisor(item, no_params, info):
|
||||||
|
for line in info[1]:
|
||||||
|
if item == str(line[0]):
|
||||||
|
infotext = ""
|
||||||
|
status = 0
|
||||||
|
supNbSrvTotal = int(line[1])
|
||||||
|
supNbSrvOk = int(line[2])
|
||||||
|
supNbSrvNok = int(line[3])
|
||||||
|
supAvailable = int(line[4])
|
||||||
|
if supAvailable != 1 :
|
||||||
|
status = 2
|
||||||
|
infotext += "Supervisor is not available"
|
||||||
|
yield status, infotext
|
||||||
|
else:
|
||||||
|
infotext = "Supervisor is available "
|
||||||
|
yield status, infotext
|
||||||
|
if supNbSrvNok > 0 :
|
||||||
|
status = 2
|
||||||
|
infotext = "There are %s unavailable servers" %supNbSrvNok
|
||||||
|
yield status, infotext
|
||||||
|
else:
|
||||||
|
infotext = "All servers are available"
|
||||||
|
yield status, infotext
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["scality_ring.supervisor"] = {
|
||||||
|
"check_function": check_scality_supervisor,
|
||||||
|
"inventory_function": inventory_scality_supervisor,
|
||||||
|
"service_description": "Supervisor %s",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#############Storage#############
|
||||||
|
from cmk.base.check_legacy_includes.df import *
|
||||||
|
from cmk.base.check_legacy_includes.size_trend import *
|
||||||
|
#factory_settings["filesystem_default_levels"] = FILESYSTEM_DEFAULT_LEVELS
|
||||||
|
|
||||||
|
def inventory_scality_storage(info):
|
||||||
|
for line in info[0]:
|
||||||
|
yield (line[0],{})
|
||||||
|
|
||||||
|
def check_scality_storage(item, params, info):
|
||||||
|
for line in info[0]:
|
||||||
|
if item in line:
|
||||||
|
ringStorageAvailable = float(line[5])
|
||||||
|
ringStorageTotal = float(line[6])
|
||||||
|
fslist=[(item, ringStorageTotal, ringStorageAvailable, 0)]
|
||||||
|
return df_check_filesystem_list(item, params, fslist)
|
||||||
|
|
||||||
|
check_info["scality_ring.storage"] = {
|
||||||
|
"check_function": check_scality_storage,
|
||||||
|
"inventory_function": inventory_scality_storage,
|
||||||
|
"service_description": "Ring %s Storage",
|
||||||
|
"default_levels_variable": "filesystem_default_levels",
|
||||||
|
"has_perfdata": True,
|
||||||
|
"group": "filesystem",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##############RING STATUS############
|
||||||
|
def inventory_scality_ring(info):
|
||||||
|
for line in info[0]:
|
||||||
|
yield (line[0],{})
|
||||||
|
|
||||||
|
def check_scality_ring(item, no_params, info):
|
||||||
|
for line in info[0]:
|
||||||
|
if item in line:
|
||||||
|
ringstaterun = line[1]
|
||||||
|
ringstate = line[2]
|
||||||
|
if ringstate == "RUN":
|
||||||
|
status = 0
|
||||||
|
text = "Ring is in Run State"
|
||||||
|
elif ringstate =="LOOP":
|
||||||
|
status = 2
|
||||||
|
text = "Ring is LOOP State"
|
||||||
|
else:
|
||||||
|
status = 2
|
||||||
|
text = "Ring is in Balancing State"
|
||||||
|
|
||||||
|
yield status, text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
check_info["scality_ring"] = {
|
||||||
|
"check_function": check_scality_ring,
|
||||||
|
"inventory_function": inventory_scality_ring,
|
||||||
|
"service_description": "Ring %s State",
|
||||||
|
"snmp_info": [
|
||||||
|
(".1.3.6.1.4.1.37489.2.1.1.1.4.1.1",
|
||||||
|
[
|
||||||
|
"2", #ringName
|
||||||
|
"3", #ringStateRun
|
||||||
|
"8", #ringState
|
||||||
|
"9", #ringDiskTotal
|
||||||
|
"13", #ringStorageUsed
|
||||||
|
"14", #ringStorageAvailable
|
||||||
|
"15", #ringStorageTotal
|
||||||
|
]),
|
||||||
|
(".1.3.6.1.4.1.37489.2.1.1.1.4.2.1",
|
||||||
|
[
|
||||||
|
"2", #supName
|
||||||
|
"5", #supNbSrvTotal
|
||||||
|
"6", #supNbSrvOK
|
||||||
|
"7", #supNbSrvNok
|
||||||
|
"8", #supAvailable
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
"snmp_scan_function": lambda oid: "scality" in oid(".1.3.6.1.2.1.1.1.0").lower(),
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
|
||||||
|
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
|
||||||
|
# conditions defined in the file COPYING, which is part of this source code package.
|
||||||
|
|
||||||
|
from cmk.gui.i18n import _
|
||||||
|
from cmk.gui.plugins.wato.utils import (
|
||||||
|
CheckParameterRulespecWithItem,
|
||||||
|
rulespec_registry,
|
||||||
|
RulespecGroupCheckParametersApplications,
|
||||||
|
Transform,
|
||||||
|
)
|
||||||
|
from cmk.gui.valuespec import Dictionary, Integer, Tuple, TextInput
|
||||||
|
|
||||||
|
def _item_spec_scality_disks():
|
||||||
|
return TextInput(
|
||||||
|
title=_("Ring"), help=_("Ring Name")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _parameter_valuespec_scality_disks():
|
||||||
|
return Dictionary(
|
||||||
|
elements=[
|
||||||
|
(
|
||||||
|
"disks",
|
||||||
|
Tuple(
|
||||||
|
help=_(
|
||||||
|
"This rule sets lower limits for the number of disks in the "
|
||||||
|
"scality ring system and it's applied for each RING"
|
||||||
|
),
|
||||||
|
title=_("Minimum number of disks:"),
|
||||||
|
elements=[
|
||||||
|
Integer(title=_("Warning below")),
|
||||||
|
Integer(title=_("Critical below")),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
rulespec_registry.register(
|
||||||
|
CheckParameterRulespecWithItem(
|
||||||
|
check_group_name="scality_disks",
|
||||||
|
group=RulespecGroupCheckParametersApplications,
|
||||||
|
item_spec=_item_spec_scality_disks,
|
||||||
|
match_type="dict",
|
||||||
|
parameter_valuespec=_parameter_valuespec_scality_disks,
|
||||||
|
title=lambda: _("Scality Ring Disk Number"),
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user