Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / eltek_outdoor_temp
blob0f4212459896daad61445d5adf82fad3b0dccbbe
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2016 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 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.0 1 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.0
28 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.1 2 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.1
29 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.2 3 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.2
30 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.3 4 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.3
31 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.4 5 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.4
32 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.5 6 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.5
33 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.6 7 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.6
34 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.7 8 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.7
35 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.8 9 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.8
36 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.9 10 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.9
37 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.10 11 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.10
38 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.11 12 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.11
39 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.12 13 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.12
40 # .1.3.6.1.4.1.12148.9.1.17.3.1.1.13 14 --> ELTEK-DISTRIBUTED-MIB::ioUnitID.13
41 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.0 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.0
42 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.1 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.1
43 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.2 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.2
44 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.3 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.3
45 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.4 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.4
46 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.5 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.5
47 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.6 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.6
48 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.7 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.7
49 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.8 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.8
50 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.9 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.9
51 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.10 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.10
52 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.11 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.11
53 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.12 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.12
54 # .1.3.6.1.4.1.12148.9.1.17.3.1.2.13 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp1.13
55 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.0 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.0
56 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.1 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.1
57 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.2 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.2
58 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.3 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.3
59 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.4 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.4
60 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.5 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.5
61 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.6 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.6
62 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.7 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.7
63 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.8 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.8
64 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.9 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.9
65 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.10 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.10
66 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.11 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.11
67 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.12 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.12
68 # .1.3.6.1.4.1.12148.9.1.17.3.1.3.13 0 --> ELTEK-DISTRIBUTED-MIB::ioUnitOutDoorTemp2.13
70 # suggested by customer
71 factory_settings['eltek_outdoor_temp_default_variables'] = {
72 'levels': (35, 40),
76 def inventory_eltek_outdoor_temp(info):
77 inventory = []
78 for index, temp1, temp2 in info:
79 if int(temp1) > 0:
80 inventory.append(("1/%s" % index, {}))
81 if int(temp2) > 0:
82 inventory.append(("2/%s" % index, {}))
83 return inventory
86 def check_eltek_outdoor_temp(item, params, info):
87 for index, temp1, temp2 in info:
88 for temp_id, reading in [("1", float(temp1)), ("2", float(temp2))]:
89 if "%s/%s" % (temp_id, index) == item:
90 return check_temperature(reading, params, "eltek_outdoor_temp_%s" % item)
93 check_info['eltek_outdoor_temp'] = {
94 'inventory_function': inventory_eltek_outdoor_temp,
95 'check_function': check_eltek_outdoor_temp,
96 'service_description': 'Temperature Outdoor %s',
97 'has_perfdata': True,
98 'snmp_info': (
99 ".1.3.6.1.4.1.12148.9.1.17.3.1",
101 "1", # ioUnitID
102 "2", # ioUnitOutDoorTemp1
103 "3", # ioUnitOutDoorTemp2
105 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.12148.9"),
106 'default_levels_variable': 'eltek_outdoor_temp_default_variables',
107 'includes': ['temperature.include'],