2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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 inventory_apc_ats_status(info
):
30 return [(None, saveint(info
[0][1]))]
34 def check_apc_ats_status(_no_item
, source
, info
):
35 comstatus
, selected_source
, redundancy
, overcurrent
, ps5
, ps24
= map(saveint
, info
[0])
39 #current source of power
40 sources
= {1: "A", 2: "B"}
41 if source
!= selected_source
:
43 messages
.append("Power source Changed from %s to %s(!!)" % \
44 (sources
[source
], sources
[selected_source
]))
46 messages
.append("Power source %s selected" % sources
[source
])
48 #current communication status of the Automatic Transfer Switch.
51 messages
.append("Communication Status: never Discovered(!)")
54 messages
.append("Communication Status: lost(!!)")
56 # current redundancy state of the ATS.
57 # Lost(1) indicates that the ATS is unable to switch over to the alternate power source
58 # if the current source fails. Redundant(2) indicates that the ATS will switch
59 # over to the alternate power source if the current source fails.
62 messages
.append("redundancy lost(!!)")
64 messages
.append("Device fully redundant")
66 # current state of the ATS. atsOverCurrent(1) indicates that the ATS has i
67 # exceeded the output current threshold and will not allow a switch
68 # over to the alternate power source if the current source fails.
69 # atsCurrentOK(2) indicates that the output current is below the output current threshold.
72 messages
.append("exceedet ouput current threshold(!!)")
77 messages
.append("5V power supply failed(!!)")
82 messages
.append("24V power suppy failed(!!)")
84 return state
, ", ".join(messages
)
87 check_info
["apc_ats_status"] = {
88 "check_function": check_apc_ats_status
,
89 "inventory_function": inventory_apc_ats_status
,
90 "service_description": "ATS Status",
91 "snmp_scan_function": lambda oid
: ".1.3.6.1.4.1.318.1.3.11" in oid(".1.3.6.1.2.1.1.2.0"),
93 ".1.3.6.1.4.1.318.1.1.8.5.1",
95 "1.0", # atsStatusCommStatus
96 "2.0", # atsStatusSelectedSource
97 "3.0", # atsStatusRedundancyState
98 "4.0", # atsStatusOverCurrentState
99 "5.0", # atsStatus5VPowerSupply
100 "6.0", # atsStatus24VPowerSupply