Cleanup config.nodes_of
[check_mk.git] / checks / netscaler_ha
blob81e06e1fdfe9d872b3ef384777d300999fcfaf44
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 # Example Output:
28 # .1.3.6.1.4.1.5951.4.1.1.23.3.0 1
29 # .1.3.6.1.4.1.5951.4.1.1.23.23.0 1
30 # .1.3.6.1.4.1.5951.4.1.1.23.24.0 3
32 netscaler_ha_cur_states = {
33 0: ("unknown", 1),
34 # 1 Indicates that the node is in the process of becoming part of the high
35 # availability configuration.
36 1: ("initializing", 1),
37 2: ("down", 2), # undocumented
38 # 3 Indicates that the node is accessible and can function as either
39 # a primary or secondary node.
40 3: ("functional", 0),
41 # 4 Indicates that one of the high availability monitored interfaces
42 # has failed because of a card or link failure. # This state triggers a
43 # failover.
44 4: ("some HA monitored interfaces failed", 2),
45 5: ("monitorFail", 1), # undocumented
46 6: ("monitorOK", 1), # undocumented
47 # 7 Indicates that all the interfaces of the node are
48 # unusable because the interfaces on which high
49 # availability monitoring is enabled are not connected
50 # or are manually disabled. This state triggers a failover.
51 7: ("all HA monitored interfaces failed", 2),
52 # 8 Indicates that the node is in listening mode. It does not
53 # participate in high availability transitions or transfer
54 # configuration from the peer node. This is a configured
55 # value, not a statistic.
56 8: ("configured to listening mode (dumb)", 1),
57 # 9 Indicates that the high availability status of the node has been
58 # manually disabled. Synchronization and propagation cannot take
59 # place between the peer nodes.
60 9: ("HA status manually disabled", 1),
61 # 10 Indicates that the SSL card has failed. This state triggers a failover.
62 10: ("SSL card failed", 2),
63 # 11 Indicates that the route monitor has failed. This state triggers
64 # a failover.
65 11: ("route monitor has failed", 2),
68 netscaler_ha_peer_mode = {
69 0: ("standalone", 0),
70 1: ("primary", 0),
71 2: ("secondary", 0),
72 3: ("unknown", 1),
76 def inventory_netscaler_ha(info):
77 if info:
78 return [(None, None)]
81 def check_netscaler_ha(_no_item, _no_params, info):
82 if info:
83 state = 0
84 peer_state, cur_status, cur_state = map(int, info[0])
85 if cur_status == 0:
86 infotext = "System not setup for HA"
87 else:
88 infotext = "State: %s, Neighbour: %s" % (
89 netscaler_ha_cur_states[cur_state][0],
90 netscaler_ha_peer_mode[peer_state][0],
92 state = max(netscaler_ha_cur_states[cur_state][1],
93 netscaler_ha_peer_mode[peer_state][1])
95 return state, infotext
98 check_info["netscaler_ha"] = {
99 "check_function": check_netscaler_ha,
100 "inventory_function": inventory_netscaler_ha,
101 "service_description": "HA Node Status",
102 "snmp_info": (
103 ".1.3.6.1.4.1.5951.4.1.1.23",
104 [ # nsHighAvailabilityGroup
105 3, # haPeerState
106 23, # haCurStatus
107 24, # haCurState
109 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5951.1"),