Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / stormshield_cluster
blob9ad76295078fb7aeca510d64d8563d768afb2e80
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 # Older versions replay an empty string if the state is Unknown / Error state
29 sync_name_mapping = {
30 '1': 'Synced',
31 '0': 'Not Synced',
32 '-1': 'Unknown / Error',
33 '': 'Unknown / Error',
36 sync_status_mapping = {
37 '1': 0,
38 '0': 2,
39 '-1': 3,
40 '': 3,
44 def inventory_stormshield_cluster(info):
45 yield None, None
48 def check_stormshield_cluster(item, params, info):
49 for number, not_replying, active, eth_links, faulty_links, sync in info:
50 not_replying = int(not_replying)
51 faulty_links = int(faulty_links)
53 yield sync_status_mapping[sync], 'Sync Status: %s' % sync_name_mapping[sync]
54 yield 0, 'Member: %s, Active: %s, Links used: %s' % (number, active, eth_links)
56 if not_replying > 0:
57 status = 2
58 else:
59 status = 0
60 yield status, 'Not replying: %s' % not_replying
62 if faulty_links > 0:
63 status = 2
64 else:
65 status = 0
66 yield status, 'Faulty: %s' % faulty_links
69 check_info['stormshield_cluster'] = {
70 'inventory_function': inventory_stormshield_cluster,
71 'check_function': check_stormshield_cluster,
72 'service_description': 'HA Status',
73 'has_perfdata': False,
74 'snmp_info': (
75 '.1.3.6.1.4.1.11256.1.11',
77 '1', # 'Number of firewalls in the HA cluster'
78 '2', # 'Number of firewalls registered in the HA cluster but not replying'
79 '3', # 'Number of active firewalls'
80 '5', # 'Number of ethernet links used for HA communication'
81 '6', # 'Number of faulty HA links'
82 '8', # snsHASyncStatus
83 ]),
84 'snmp_scan_function': stormshield_scan_function,
85 'includes': ['stormshield.include'],