2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2017 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # comNET GmbH, Fabian Binder
29 # .1.3.6.1.4.1.9148.3.2.1.1.3 Health Score (apSysHealthScore)
30 # .1.3.6.1.4.1.9148.3.2.1.1.4 Health Status Description (apSysRedundancy)
32 factory_settings
["acme_sbc_snmp_default_levels"] = {
33 "levels_lower": (99, 75),
37 def inventory_acme_sbc_snmp(info
):
41 def check_acme_sbc_snmp(_no_item
, params
, info
):
47 "4": (2, "out of service"),
48 "5": (2, "unassigned"),
49 "6": (1, "active (pending)"),
50 "7": (1, "standby (pending)"),
51 "8": (1, "out of service (pending)"),
56 score
, state
= info
[0]
57 except (IndexError, ValueError):
59 health_state
, health_state_readable
= map_states
.get(state
, (3, "unknown"))
60 yield health_state
, "Health state: %s" % (health_state_readable
)
65 yield 3, "Unknown score: %s" % score
67 warn
, crit
= params
.get("levels_lower", (None, None))
68 levels_msg
= " (warn/crit at or below %s%%/%s%%)" % (warn
, crit
)
69 score_msg
= "Score: %s%%" % score
70 if crit
is not None and score
<= crit
:
71 yield 2, score_msg
+ levels_msg
72 elif warn
is not None and score
<= warn
:
73 yield 1, score_msg
+ levels_msg
78 check_info
['acme_sbc_snmp'] = {
79 'inventory_function': inventory_acme_sbc_snmp
,
80 'check_function': check_acme_sbc_snmp
,
81 'service_description': 'ACME SBC health',
83 '.1.3.6.1.4.1.9148.3.2.1.1',
85 "3", # APSYSMGMT-MIB::apSysHealthScore
86 "4", # APSYSMGMT-MIB::apSysRedundancy
88 'snmp_scan_function': scan_acme
,
89 'includes': ['acme.include'],
90 'group': 'acme_sbc_snmp',
91 'default_levels_variable': 'acme_sbc_snmp_default_levels',