Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / lgp_info
blob6667128c3e228a9fefc117f29fef47caab57749e
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.
27 # Check has been developed using a Emerson Network Power Rack PDU Card
28 # Agent App Firmware Version 4.840.0
29 # Agent Boot Firmware Version 4.540.3
30 # FDM Version 1209
31 # GDD Version 45585
33 # Example info data:
34 # [[['Rack PDU Card', '4.840.0', '535055G103T2010JUN240295']], [['1', '1', '.1.3.6.1.4.1.476.1.42.4.8.2.2', 'Emerson Network Power', '1']]]
36 lgp_info_devices = {
37 '.1.3.6.1.4.1.476.1.42.4.8.2.1': 'lgpMPX',
38 '.1.3.6.1.4.1.476.1.42.4.8.2.2': 'lgpMPH',
42 def inventory_lgp_info(info):
43 if info and info[0] and info[0][0]:
44 return [(None, None)]
47 def check_lgp_info(item, params, info):
48 if info and info[0] and info[0][0]:
49 agent_info = info[0][0]
51 device_output = ''
52 if len(info) > 1:
53 devices = []
54 for id_, manufacturer, unit_number in info[1]:
55 id_ = lgp_info_devices.get(id_, id_)
56 devices.append(
57 'ID: %s, Manufacturer: %s, Unit-Number: %s' % (id_, manufacturer, unit_number))
58 device_output = '\n'.join(devices)
60 return (0, 'Model: %s, Firmware: %s, S/N: %s\n%s' % tuple(agent_info + [device_output]))
62 check_info["lgp_info"] = {
63 'check_function': check_lgp_info,
64 'inventory_function': inventory_lgp_info,
65 'service_description': 'Liebert Info',
66 'snmp_info': [('.1.3.6.1.4.1.476.1.42.2.1', [
67 '2.0', # LIEBERT-GP-AGENT-MIB::lgpAgentIdentModel.0
68 '3.0', # LIEBERT-GP-AGENT-MIB::lgpAgentIdentFirmwareVersion.0
69 '4.0', # LIEBERT-GP-AGENT-MIB::lgpAgentIdentSerialNumber.0
70 ]),
71 ('.1.3.6.1.4.1.476.1.42.2.4.2.1', [
72 '2', # LIEBERT-GP-AGENT-MIB::lgpAgentDeviceId.1
73 '3', # LIEBERT-GP-AGENT-MIB::lgpAgentDeviceManufacturer.1
74 '6', # LIEBERT-GP-AGENT-MIB::lgpAgentDeviceUnitNumber.1
75 ])],
76 'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0') == \
77 '.1.3.6.1.4.1.476.1.42',