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.
28 # .1.3.6.1.4.1.9.9.176.1.1.1.0 0 --> CISCO-RF-MIB::cRFStatusUnitId.0
29 # .1.3.6.1.4.1.9.9.176.1.1.2.0 14 --> CISCO-RF-MIB::cRFStatusUnitState.0
30 # .1.3.6.1.4.1.9.9.176.1.1.3.0 0 --> CISCO-RF-MIB::cRFStatusPeerUnitId.0
31 # .1.3.6.1.4.1.9.9.176.1.1.4.0 2 --> CISCO-RF-MIB::cRFStatusPeerUnitState.0
32 # .1.3.6.1.4.1.9.9.176.1.1.6.0 2 --> CISCO-RF-MIB::cRFStatusDuplexMode.0
33 # .1.3.6.1.4.1.9.9.176.1.1.8.0 1 --> CISCO-RF-MIB::cRFStatusLastSwactReasonCode.0
36 def inventory_cisco_redundancy(info
):
38 swact_reason
= info
[0][5]
42 if swact_reason
!= "1":
43 return [(None, {"init_states" : info
[0][:5]})]
47 def check_cisco_redundancy(_no_item
, params
, info
):
53 "3" : "initialization",
56 "6" : "standby cold config",
57 "7" : "standby cold file sys",
58 "8" : "standby cold bulk",
61 "11" : "active drain",
62 "12" : "active pre-config",
63 "13" : "active post-config",
65 "15" : "active extra load",
66 "16" : "active handback",
69 "2" : "False (SUB-Peer not detected)",
70 "1" : "True (SUB-Peer detected)",
76 "4" : "user initiated",
78 "6" : "active unit failed",
79 "7" : "active unit removed",
84 for what
, states
in [("now", info
[0][:5]), ("init", params
["init_states"])]:
85 unit_id
, unit_state
, peer_id
, peer_state
, duplex_mode
= states
86 infotexts
[what
] = "Unit ID: %s (%s), Peer ID: %s (%s), Duplex mode: %s" % \
87 (unit_id
, map_states
["unit_state"][unit_state
], \
88 peer_id
, map_states
["unit_state"][peer_state
], \
89 map_states
["duplex_mode"][duplex_mode
])
91 unit_id
, unit_state
, peer_id
, peer_state
, duplex_mode
, _swact_reason
= info
[0]
93 if params
["init_states"] == info
[0][:5]:
95 infotext
= "%s, Last swact reason code: %s" % \
96 (infotexts
["now"], map_states
["swact_reason"][info
[0][5]])
98 if unit_state
in ["2", "9", "14"] or peer_state
in ["2", "9", "14"]:
103 infotext
= "Switchover - Old status: %s, New status: %s" % \
104 (infotexts
["init"], infotexts
["now"])
106 if peer_state
== "1":
109 return state
, infotext
112 check_info
['cisco_redundancy'] = {
113 'inventory_function' : inventory_cisco_redundancy
,
114 'check_function' : check_cisco_redundancy
,
115 'service_description' : 'Redundancy Framework Status',
116 'snmp_info' : ('.1.3.6.1.4.1.9.9.176.1.1', [
118 2, # cRFStatusUnitState
119 3, # cRFStatusPeerUnitId
120 4, # cRFStatusPeerUnitState
121 6, # cRFStatusDuplexMode
122 8, # cRFStatusLastSwactReasonCode
124 'snmp_scan_function' : lambda oid
: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower() \
125 and oid(".1.3.6.1.4.1.9.9.176.1.1.*"),