From b3a43a96b195a3cf35f37504c837eb34fa8b1fa2 Mon Sep 17 00:00:00 2001 From: George Pochiscan Date: Fri, 24 Feb 2023 12:45:49 +0200 Subject: [PATCH] added scality ring developed check --- check_mk-scality-ring/README.MD | 9 + check_mk-scality-ring/ScalityRing-1.0.1.mkp | Bin 0 -> 2702 bytes .../local/share/check_mk/checks/scality | 167 ++++++++++++++++++ .../web/plugins/wato/scality_disks.py | 52 ++++++ 4 files changed, 228 insertions(+) create mode 100644 check_mk-scality-ring/README.MD create mode 100644 check_mk-scality-ring/ScalityRing-1.0.1.mkp create mode 100644 check_mk-scality-ring/local/share/check_mk/checks/scality create mode 100644 check_mk-scality-ring/local/share/check_mk/web/plugins/wato/scality_disks.py diff --git a/check_mk-scality-ring/README.MD b/check_mk-scality-ring/README.MD new file mode 100644 index 0000000..bde66d9 --- /dev/null +++ b/check_mk-scality-ring/README.MD @@ -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. diff --git a/check_mk-scality-ring/ScalityRing-1.0.1.mkp b/check_mk-scality-ring/ScalityRing-1.0.1.mkp new file mode 100644 index 0000000000000000000000000000000000000000..e2f3b0b5bc0ff830a3d61da38ad18ac178765fa4 GIT binary patch literal 2702 zcmbWz=_3;i0|0QzRgznz&_;;dk7Lfr;|j~%S6ueo$i3pS(+oXd4C{76j3SdMsMv;*l!s1;Fe@rO7qxA5#nQJu1lx`XobYcieT|@&;<` znxgd|Sw(+o&=mb-v8-=={rO(zt}F{7E_1lIP;Lj`MXFBUO)xaYf}5j(qu;Y5!ZK5? zKWS8-^W4p_m(_SMx8<3;F1h-Qp7v8%&!G>J3p|r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m}#*XqI3EULf#f!6KEC zGz~ z&a3MT>aE`T_38fnhve<@@g!vz+|;M2;pWw5NwCsVaH%l@J3c6>wBYe_{U|T4CLz3o z;>Uu{D!<%&;!eym)26jp-Q8TWh5S=c(fA>1duDKp-K0_L{$=ITqwLZcg`dZ3Ym=mE zFP@4AZ#P=dIh`!LpB1ji=Tel-L0aZ(Il(N`CrvFNuo4qkctsK<4=iRe#^@Ukd%m;e zMu~4`)!D#?$@71HQD0m@v45^&Q$;l!%IU{p!JC~TBEGhMLJ_eMMV<1tWODhk?So&r za>PIP4DeJP5^7xRvI6C3DFM{mD(5%QGx`E!b~~c`6bEb4vg1*&R&wweRkW247~yUs z?5&tV$Q9j3Tk&$EaP;O{iF-_}WM9jDkFI+Q%Lw>TvVm}xpj*)`*8LW#e>+>he-XLH z|G1d%@hufEqO~LrGF7{HeqXPl5z?hHq$KmdtP>3gaPr1@!+r;K!5cSvIX>4r44*m# z&i3Hft~^_>r|z8Z<4BBlqlyvHcUH+0y4#^#yqJ2@D8OblBprME@3zXf3RB>qb_*ko$Rbk zL6v0Y+~FXhXixQ~weFvK1KX{N(eoYG2sAWmJo;slSUO3tdFWdc_HxO)aY;eAqYKKzyxMGMbl!h>wvX z9#IC(OmUVW#xF}zBl=N<#5B{qT5Y;gpsR7wh!#&@yOV00R=c3v&Jl~jm-A2Xc&+@i0=6<{bj(DWX7o*IrgbEQ zfV2=aQax3zbNDW|r2VmS$B$>@yk3!o_^o!^eqzji!}$IQZ;SviAvfhz;lyb 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(), +} + diff --git a/check_mk-scality-ring/local/share/check_mk/web/plugins/wato/scality_disks.py b/check_mk-scality-ring/local/share/check_mk/web/plugins/wato/scality_disks.py new file mode 100644 index 0000000..8222f23 --- /dev/null +++ b/check_mk-scality-ring/local/share/check_mk/web/plugins/wato/scality_disks.py @@ -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"), + ) +)