Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / bluenet_meter
blob60b3690c2f2e82d4ff6a40cc24f586aafa9d24dc
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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.
28 def parse_bluenet_meter(info):
29 parsed = {}
30 for meter_id, power_p, power_s, u_rms, i_rms in info:
31 # do not take into account powermeters with no voltage
32 if u_rms != "0":
33 parsed.setdefault(meter_id, {})
34 parsed[meter_id]["voltage"] = float(u_rms) / 1000.0, None
35 parsed[meter_id]["current"] = float(i_rms) / 1000.0, None
36 parsed[meter_id]["power"] = float(power_p), None
37 parsed[meter_id]["appower"] = float(power_s), None
38 return parsed
41 check_info["bluenet_meter"] = {
42 "parse_function": parse_bluenet_meter,
43 "inventory_function": inventory_elphase,
44 "check_function": check_elphase,
45 "service_description": "Powermeter %s",
46 "group": "ups_outphase",
47 "has_perfdata": True,
48 "snmp_info": (
49 ".1.3.6.1.4.1.21695.1.10.7.2.1",
51 1, # e3lpmMeter
52 5, # e3lpmPowerP
53 7, # e3lpmPowerS
54 8, # e3lpmUrms
55 9, # e3lpmIrms
56 ]),
57 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.21695.1",
58 "includes": ["elphase.include"],