2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.9.9.117.1.1.1.1.2.16 "centiAmpsAt12V"
28 # some more examples (but we dont know all):
34 # => calculate power = factor * amps * volt
36 # .1.3.6.1.4.1.9.9.117.1.1.4.1.1.16 11333
37 # .1.3.6.1.4.1.9.9.117.1.1.4.1.2.16 9666
38 # .1.3.6.1.4.1.9.9.117.1.1.4.1.3.16 6000
39 # .1.3.6.1.4.1.9.9.117.1.1.4.1.4.16 122
41 # .1.3.6.1.4.1.9.9.117.1.1.4.1.1.13 11333
42 # .1.3.6.1.4.1.9.9.117.1.1.4.1.2.13 5583
43 # .1.3.6.1.4.1.9.9.117.1.1.4.1.3.13 6980
44 # .1.3.6.1.4.1.9.9.117.1.1.4.1.4.13 0 <= exclude
47 def parse_cisco_fru_powerusage(info
):
49 powerunit
, powervals
= info
50 if powerunit
and powervals
:
51 oidend
, powerunit_str
= powerunit
[0]
52 factor_str
, voltage_str
= powerunit_str
.lower().split("amps")
54 if "milli" in factor_str
.lower():
56 elif "centi" in factor_str
.lower():
61 voltage
= float(voltage_str
.lower().replace("at", "").\
62 replace("@", "").replace("v", "").strip())
64 if oidend
== powervals
[0][0]:
65 system_total
, system_drawn
, inline_total
, inline_drawn
= map(float, powervals
[0][1:])
67 ("system total", system_total
), # Gesamtstrom
68 ("system drawn", system_drawn
), # aufgenommene Gesamtstromstaerke
69 ("inline total", inline_total
),
70 ("inline drawn", inline_drawn
)
72 parsed
.setdefault(what
, {
73 "power": factor
* val
* voltage
,
74 "current": factor
* val
,
81 def inventory_cisco_fru_powerusage(parsed
):
82 for what
, data
in parsed
.items():
83 if data
["current"] > 0:
87 check_info
['cisco_fru_powerusage'] = {
88 'parse_function': parse_cisco_fru_powerusage
,
89 'inventory_function': inventory_cisco_fru_powerusage
,
90 'check_function': check_elphase
,
91 'service_description': 'FRU power usage %s',
95 ".1.3.6.1.4.1.9.9.117.1.1.1.1.2",
98 "", # CISCO-ENTITY-FRU-CONTROL-MIB::cefcPowerUnits
101 ".1.3.6.1.4.1.9.9.117.1.1.4.1",
104 "1", # CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUTotalSystemCurrent
105 "2", # CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUDrawnSystemCurrent
106 "3", # CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUTotalInlineCurrent
107 "4", # CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUDrawnInlineCurrent
110 'snmp_scan_function': lambda oid
: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower(),
111 'includes': ["elphase.include"],
112 'group': 'el_inphase'