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.176.1.1.1.0 0 --> CISCO-RF-MIB::cRFStatusUnitId.0
28 # .1.3.6.1.4.1.9.9.176.1.1.2.0 14 --> CISCO-RF-MIB::cRFStatusUnitState.0
29 # .1.3.6.1.4.1.9.9.176.1.1.3.0 0 --> CISCO-RF-MIB::cRFStatusPeerUnitId.0
30 # .1.3.6.1.4.1.9.9.176.1.1.4.0 2 --> CISCO-RF-MIB::cRFStatusPeerUnitState.0
31 # .1.3.6.1.4.1.9.9.176.1.1.6.0 2 --> CISCO-RF-MIB::cRFStatusDuplexMode.0
32 # .1.3.6.1.4.1.9.9.176.1.1.8.0 1 --> CISCO-RF-MIB::cRFStatusLastSwactReasonCode.0
35 def inventory_cisco_redundancy(info
):
37 swact_reason
= info
[0][5]
41 if swact_reason
!= "1":
42 return [(None, {"init_states": info
[0][:5]})]
46 def check_cisco_redundancy(_no_item
, params
, info
):
52 "3": "initialization",
55 "6": "standby cold config",
56 "7": "standby cold file sys",
57 "8": "standby cold bulk",
61 "12": "active pre-config",
62 "13": "active post-config",
64 "15": "active extra load",
65 "16": "active handback",
68 "2": "False (SUB-Peer not detected)",
69 "1": "True (SUB-Peer detected)",
75 "4": "user initiated",
77 "6": "active unit failed",
78 "7": "active unit removed",
83 for what
, states
in [("now", info
[0][:5]), ("init", params
["init_states"])]:
84 unit_id
, unit_state
, peer_id
, peer_state
, duplex_mode
= states
85 infotexts
[what
] = "Unit ID: %s (%s), Peer ID: %s (%s), Duplex mode: %s" % \
86 (unit_id
, map_states
["unit_state"][unit_state
], \
87 peer_id
, map_states
["unit_state"][peer_state
], \
88 map_states
["duplex_mode"][duplex_mode
])
90 unit_id
, unit_state
, peer_id
, peer_state
, duplex_mode
, _swact_reason
= info
[0]
92 if params
["init_states"] == info
[0][:5]:
94 infotext
= "%s, Last swact reason code: %s" % \
95 (infotexts
["now"], map_states
["swact_reason"][info
[0][5]])
97 if unit_state
in ["2", "9", "14"] or peer_state
in ["2", "9", "14"]:
102 infotext
= "Switchover - Old status: %s, New status: %s" % \
103 (infotexts
["init"], infotexts
["now"])
105 if peer_state
== "1":
108 return state
, infotext
111 check_info
['cisco_redundancy'] = {
112 'inventory_function' : inventory_cisco_redundancy
,
113 'check_function' : check_cisco_redundancy
,
114 'service_description' : 'Redundancy Framework Status',
115 'snmp_info' : ('.1.3.6.1.4.1.9.9.176.1.1', [
117 2, # cRFStatusUnitState
118 3, # cRFStatusPeerUnitId
119 4, # cRFStatusPeerUnitState
120 6, # cRFStatusDuplexMode
121 8, # cRFStatusLastSwactReasonCode
123 'snmp_scan_function' : lambda oid
: "cisco" in oid(".1.3.6.1.2.1.1.1.0").lower() \
124 and oid(".1.3.6.1.4.1.9.9.176.1.1.*"),