2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 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 factory_settings
["docsis_channels_downstream"] = {
32 def inventory_docsis_channels_downstream(info
):
38 def check_docsis_channels_downstream(item
, params
, info
):
39 for channel_id
, frequency
, power
in info
:
40 if channel_id
== item
:
42 warn
, crit
= params
["power"]
43 power_dbmv
= float(int(power
)) / 10
44 infotext
= "Power is %.1f dBmV" % power_dbmv
45 levels
= " (Levels Warn/Crit at %d dBmV/ %d dBmV)" % (warn
, crit
)
47 if power_dbmv
<= crit
:
50 elif power_dbmv
<= warn
:
53 yield state
, infotext
, [('power', power_dbmv
, warn
, crit
)]
56 frequency_mhz
= float(frequency
) / 1000000
57 infotext
= "Frequency is %.1f MHz" % frequency_mhz
58 perfdata
= [("frequency", frequency_mhz
, warn
, crit
)]
60 if "frequency" in params
:
61 warn
, crit
= params
["frequency"]
62 levels
= " (warn/crit at %d MHz/ %d MHz)" % (warn
, crit
)
63 if frequency_mhz
>= crit
:
66 elif frequency_mhz
>= warn
:
69 # Change this to yield in case of future extension of the check
70 yield state
, infotext
, perfdata
73 yield 3, "Channel information not found in SNMP data"
76 # This Check is a subcheck because there is also a upstream version possible
77 check_info
["docsis_channels_downstream"] = {
78 "check_function": check_docsis_channels_downstream
,
79 "inventory_function": inventory_docsis_channels_downstream
,
80 "service_description": "Downstream Channel %s",
82 "snmp_scan_function": docsis_scan_function
,
84 ".1.3.6.1.2.1.10.127.1.1.1.1",
86 1, # docsIfDownChannelId
87 2, # docsIfDownChannelFrequency
88 6, # docsIfDownChannelPower (1/10 dBmV)
90 "group": "docsis_channels_downstream",
91 "default_levels_variable": "docsis_channels_downstream",
92 "includes": ["docsis.include"],
95 # Information for future extensions of the check:
96 # docsIfDownChannelId 1.3.6.1.2.1.10.127.1.1.1.1.1
97 # docsIfDownChannelFrequency 1.3.6.1.2.1.10.127.1.1.1.1.2
98 # docsIfDownChannelWidth 1.3.6.1.2.1.10.127.1.1.1.1.3
99 # docsIfDownChannelModulation 1.3.6.1.2.1.10.127.1.1.1.1.4
100 # docsIfDownChannelInterleave 1.3.6.1.2.1.10.127.1.1.1.1.5
101 # docsIfDownChannelPower 1.3.6.1.2.1.10.127.1.1.1.1.6
102 # docsIfDownChannelAnnex 1.3.6.1.2.1.10.127.1.1.1.1.7