Refactoring: Changed remaining check parameters starting with an 's' to the new rules...
[check_mk.git] / checks / fsc_sc2.include
blob0318c826dd744f67a069e0ca86ff9ffccefb37ea
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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 # ails. 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 # .--CPU-----------------------------------------------------------------.
28 # | ____ ____ _ _ |
29 # | / ___| _ \| | | | |
30 # | | | | |_) | | | | |
31 # | | |___| __/| |_| | |
32 # | \____|_| \___/ |
33 # | |
34 # '----------------------------------------------------------------------'
36 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.3.1.1 "CPU1"
37 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.3.1.2 "CPU2"
38 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4.1.1 3
39 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.4.1.2 2
40 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.5.1.1 "Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz"
41 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.5.1.2 ""
42 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.8.1.1 2100
43 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.8.1.2 0
44 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.13.1.1 6
45 # .1.3.6.1.4.1.231.2.10.2.2.10.6.4.1.13.1.2 0
48 def inventory_fsc_sc2_cpu_status(info):
49 for line in info:
50 if line[1] != '2':
51 yield line[0], None
54 def check_fsc_sc2_cpu_status(item, _no_params, info):
55 def get_cpu_status(status):
56 return {
57 '1': (3, 'unknown'),
58 '2': (3, 'not-present'),
59 '3': (0, 'ok'),
60 '4': (0, 'disabled'),
61 '5': (2, 'error'),
62 '6': (2, 'failed'),
63 '7': (1, 'missing-termination'),
64 '8': (1, 'prefailure-warning'),
65 }.get(status, (3, 'unknown'))
67 for designation, status, model, speed, cores in info:
68 if designation == item:
69 status_state, status_txt = get_cpu_status(status)
70 return status_state, 'Status is {0}, {1}, {2} cores @ {3} MHz'.format(
71 status_txt, model, cores, speed)
75 # .--memory--------------------------------------------------------------.
76 # | |
77 # | _ __ ___ ___ _ __ ___ ___ _ __ _ _ |
78 # | | '_ ` _ \ / _ \ '_ ` _ \ / _ \| '__| | | | |
79 # | | | | | | | __/ | | | | | (_) | | | |_| | |
80 # | |_| |_| |_|\___|_| |_| |_|\___/|_| \__, | |
81 # | |___/ |
82 # '----------------------------------------------------------------------'
84 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.1 "DIMM-1A"
85 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.2 "DIMM-2A"
86 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.3 "DIMM-3A"
87 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.4 "DIMM-1B"
88 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.5 "DIMM-2B"
89 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.6 "DIMM-3B"
90 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.7 "DIMM-1C"
91 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.8 "DIMM-2C"
92 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.3.1.9 "DIMM-3C"
93 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.1 3
94 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.2 2
95 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.3 2
96 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.4 3
97 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.5 2
98 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.6 2
99 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.7 3
100 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.8 2
101 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.4.1.9 2
102 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.1 4096
103 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.2 -1
104 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.3 -1
105 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.4 4096
106 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.5 -1
107 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.6 -1
108 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.7 4096
109 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.8 -1
110 # .1.3.6.1.4.1.231.2.10.2.2.10.6.5.1.6.1.9 -1
113 def inventory_fsc_sc2_mem_status(info):
114 for line in info:
115 if line[1] != '2':
116 yield line[0], None
119 def check_fsc_sc2_mem_status(item, _no_params, info):
120 def get_mem_status(status):
121 return {
122 '1': (3, 'unknown'),
123 '2': (3, 'not-present'),
124 '3': (0, 'ok'),
125 '4': (0, 'disabled'),
126 '5': (2, 'error'),
127 '6': (2, 'failed'),
128 '7': (1, 'prefailure-predicted'),
129 '11': (0, 'hidden'),
130 }.get(status, (3, 'unknown'))
132 for designation, status, capacity in info:
133 if designation == item:
134 status_state, status_txt = get_mem_status(status)
135 return status_state, 'Status is {0}, Size {1} MB'.format(status_txt, capacity)
139 # .--fans----------------------------------------------------------------.
140 # | __ |
141 # | / _| __ _ _ __ ___ |
142 # | | |_ / _` | '_ \/ __| |
143 # | | _| (_| | | | \__ \ |
144 # | |_| \__,_|_| |_|___/ |
145 # | |
146 # '----------------------------------------------------------------------'
148 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.1 "FAN1 SYS"
149 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.2 "FAN2 SYS"
150 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.3 "FAN3 SYS"
151 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.4 "FAN4 SYS"
152 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.5 "FAN5 SYS"
153 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.6 "FAN PSU1"
154 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.3.1.7 "FAN PSU2"
155 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.1 3
156 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.2 3
157 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.3 3
158 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.4 3
159 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.5 3
160 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.6 3
161 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.5.1.7 3
162 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.1 5820
163 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.2 6000
164 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.3 6000
165 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.4 6000
166 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.5 6120
167 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.6 2400
168 # .1.3.6.1.4.1.231.2.10.2.2.10.5.2.1.6.1.7 2400
170 factory_settings['fan_fsc_sc2_levels'] = {
171 'lower': (1500, 2000),
175 def inventory_fsc_sc2_fans(info):
176 for line in info:
177 if line[1] not in ["8"]:
178 yield line[0], {}
181 def check_fsc_sc2_fans(item, params, info):
182 status_map = {
183 '1': (3, 'Status is unknown'),
184 '2': (0, 'Status is disabled'),
185 '3': (0, 'Status is ok'),
186 '4': (2, 'Status is failed'),
187 '5': (1, 'Status is prefailure-predicted'),
188 '6': (1, 'Status is redundant-fan-failed'),
189 '7': (3, 'Status is not-manageable'),
190 '8': (0, 'Status is not-present'),
193 if isinstance(params, tuple):
194 params = {'lower': params}
196 for designation, status, rpm in info:
197 if designation == item:
198 yield status_map.get(status, (3, 'Status is unknown'))
199 if rpm:
200 yield check_fan(int(rpm), params)
201 else:
202 yield 0, "Device did not deliver RPM values"
206 # .--power---------------------------------------------------------------.
207 # | |
208 # | _ __ _____ _____ _ __ |
209 # | | '_ \ / _ \ \ /\ / / _ \ '__| |
210 # | | |_) | (_) \ V V / __/ | |
211 # | | .__/ \___/ \_/\_/ \___|_| |
212 # | |_| |
213 # '----------------------------------------------------------------------'
215 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.3.1 "CPU1 Power"
216 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.3.2 "CPU2 Power"
217 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.4.1 "HDD Power"
218 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.7.1 "System Power"
219 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.10.1 "PSU1 Power"
220 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.10.2 "PSU2 Power"
221 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.224.1 "Total Power"
222 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.4.1.224.2 "Total Power Out"
223 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.3.1 5
224 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.3.2 0
225 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.4.1 8
226 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.7.1 50
227 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.10.1 52
228 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.10.2 40
229 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.224.1 92
230 # .1.3.6.1.4.1.231.2.10.2.2.10.6.7.1.5.1.224.2 68
233 def parse_fsc_sc2_power_consumption(info):
234 parsed = {}
235 for designation, value in info:
236 # sometimes the device does not return a value
237 if not value:
238 parsed.setdefault(designation,
239 {"device_state": (3, 'Error on device while reading value')})
240 else:
241 parsed.setdefault(designation, {"power": int(value)})
242 return parsed
246 # .--info----------------------------------------------------------------.
247 # | _ __ |
248 # | (_)_ __ / _| ___ |
249 # | | | '_ \| |_ / _ \ |
250 # | | | | | | _| (_) | |
251 # | |_|_| |_|_| \___/ |
252 # | |
253 # '----------------------------------------------------------------------'
255 # .1.3.6.1.4.1.231.2.10.2.2.10.2.3.1.5.1 "PRIMERGY RX300 S8"
256 # .1.3.6.1.4.1.231.2.10.2.2.10.2.3.1.7.1 "--"
257 # .1.3.6.1.4.1.231.2.10.2.2.10.4.1.1.11.1 "V4.6.5.4 R1.6.0 for D2939-B1x"
260 def inventory_fsc_sc2_info(info):
261 if info:
262 return [(None, None)]
265 def check_fsc_sc2_info(_no_item, _no_params, info):
266 if info:
267 return (0, 'Model: {0}, Serial Number: {1}, BIOS Version: {2}'.format(
268 info[0][0], info[0][1], info[0][2]))
272 # .--temperature---------------------------------------------------------.
273 # | _ _ |
274 # | | |_ ___ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
275 # | | __/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
276 # | | || __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
277 # | \__\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
278 # | |_| |
279 # '----------------------------------------------------------------------'
281 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.1 "Ambient"
282 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.2 "Systemboard 1"
283 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.3 "Systemboard 2"
284 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.4 "CPU1"
285 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.5 "CPU2"
286 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.6 "MEM A"
287 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.7 "MEM B"
288 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.8 "MEM C"
289 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.3.1.9 "MEM D"
290 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.1 8
291 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.2 8
292 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.3 8
293 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.4 8
294 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.5 2
295 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.6 8
296 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.7 8
297 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.8 8
298 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.5.1.9 8
299 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.1 26
300 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.2 27
301 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.3 33
302 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.4 27
303 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.5 0
304 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.6 28
305 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.7 28
306 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.8 27
307 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.6.1.9 27
308 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.1 37
309 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.2 75
310 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.3 75
311 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.4 77
312 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.5 89
313 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.6 78
314 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.7 78
315 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.8 78
316 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.7.1.9 78
317 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.1 42
318 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.2 80
319 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.3 80
320 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.4 81
321 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.5 93
322 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.6 82
323 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.7 82
324 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.8 82
325 # .1.3.6.1.4.1.231.2.10.2.2.10.5.1.1.8.1.9 82
328 def inventory_fsc_sc2_temp(info):
329 for line in info:
330 if line[1] != '2':
331 yield line[0], {}
334 def check_fsc_sc2_temp(item, params, info):
335 temp_status = {
336 '1': (3, 'unknown'),
337 '2': (0, 'not-available'),
338 '3': (0, 'ok'),
339 '4': (2, 'sensor-failed'),
340 '5': (2, 'failed'),
341 '6': (1, 'temperature-warning-toohot'),
342 '7': (2, 'temperature-critical-toohot'),
343 '8': (0, 'temperature-normal'),
344 '9': (1, 'temperature-warning')
347 for designation, status, temp, dev_warn, dev_crit in info:
348 if designation == item:
349 if not temp:
350 return 3, 'Did not receive temperature data'
352 dev_status, dev_status_name = temp_status.get(status, (3, 'unknown'))
354 if not dev_warn or not dev_crit:
355 return 3, 'Did not receive device levels'
357 dev_levels = int(dev_warn), int(dev_crit)
359 return check_temperature(
360 int(temp), params, 'temp_{}'.format(item.replace(' ', '_')), 'c', dev_levels, None,
361 dev_status, dev_status_name)
365 # .--voltage-------------------------------------------------------------.
366 # | _ _ |
367 # | __ _____ | | |_ __ _ __ _ ___ |
368 # | \ \ / / _ \| | __/ _` |/ _` |/ _ \ |
369 # | \ V / (_) | | || (_| | (_| | __/ |
370 # | \_/ \___/|_|\__\__,_|\__, |\___| |
371 # | |___/ |
372 # '----------------------------------------------------------------------'
374 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.1 "BATT 3.0V"
375 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.2 "STBY 12V"
376 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.3 "STBY 5V"
377 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.4 "STBY 3.3V"
378 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.5 "LAN 1.8V STBY"
379 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.6 "iRMC 1.5V STBY"
380 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.7 "LAN 1.0V STBY"
381 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.8 "MAIN 12V"
382 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.3.1.9 "MAIN 5V"
383 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.1 3
384 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.2 3
385 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.3 3
386 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.4 3
387 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.5 3
388 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.6 3
389 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.7 3
390 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.8 3
391 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.4.1.9 3
392 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.1 3270
393 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.2 11880
394 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.3 5100
395 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.4 3350
396 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.5 1800
397 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.6 1460
398 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.7 980
399 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.8 12160
400 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.5.1.9 4980
401 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.1 2010
402 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.2 11280
403 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.3 4630
404 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.4 3020
405 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.5 1670
406 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.6 1390
407 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.7 930
408 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.8 11310
409 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.7.1.9 4630
410 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.1 3500
411 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.2 12960
412 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.3 5420
413 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.4 3570
414 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.5 1930
415 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.6 1610
416 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.7 1080
417 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.8 12900
418 # .1.3.6.1.4.1.231.2.10.2.2.10.6.3.1.8.1.9 5420
421 def parse_fsc_sc2_voltage(info):
422 # dev_state:
423 # sc2VoltageStatus OBJECT-TYPE
424 # SYNTAX INTEGER
426 # unknown(1),
427 # not-available(2),
428 # ok(3),
429 # too-low(4),
430 # too-high(5),
431 # sensor-failed(6)
433 # ACCESS read-only
434 # STATUS mandatory
435 # DESCRIPTION "Voltage status"
436 # ::= { sc2Voltages 4 }
438 parsed = {}
439 for designation, dev_state, value, min_value, max_value in info:
440 if dev_state == "2":
441 continue
442 try:
443 value = float(value) / 1000.0
444 min_value = float(min_value) / 1000.0
445 max_value = float(max_value) / 1000.0
446 except ValueError:
447 state_info = 3, 'Could not get all values'
448 parsed.setdefault(designation, {"device_state": state_info})
449 else:
450 state_info = value
451 if value < min_value:
452 state_info = value, (2, 'too low, deceeds %.2f V' % min_value)
453 elif value >= max_value:
454 state_info = value, (2, 'too high, exceeds %.2f V' % max_value)
455 parsed.setdefault(designation, {"voltage": state_info})
456 return parsed