Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / storeonce_servicesets
blob9d4ca2c39e9ac50d94c889490ff30dddc35e8aae
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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
29 # <<<storeonce_servicesets:sep(9)>>>
30 # [1]
31 # ServiceSet ID 1
32 # ServiceSet Name Service Set 1
33 # ServiceSet Alias SET1
34 # Serial Number CZ25132LTD01
35 # Software Version 3.15.1-1636.1
36 # Product Class HPE StoreOnce 4700 Backup
37 # Capacity in bytes 75952808613643
38 # Free Space in bytes 53819324528395
39 # User Data Stored in bytes 305835970141743
40 # Size On Disk in bytes 19180587585836
41 # Deduplication Ratio 15.945078260668
42 # ServiceSet Health Level 1
43 # ServiceSet Health OK
44 # ServiceSet Status Running
45 # Replication Health Level 1
46 # Replication Health OK
47 # Replication Status Running
48 # Overall Health Level 1
49 # Overall Health OK
50 # Overall Status Running
51 # Housekeeping Health Level 1
52 # Housekeeping Health OK
53 # Housekeeping Status Running
54 # Primary Node hpcz25132ltd
55 # Secondary Node None
56 # Active Node hpcz25132ltd
58 # In newer agent outputs 'capacity' has changed:
59 # cloudCapacityBytes 0
60 # cloudDiskBytes 0
61 # cloudReadWriteLicensedDiskBytes 0
62 # cloudFreeBytes 0
63 # cloudUserBytes 0
64 # localCapacityBytes 136721392009216
65 # localDiskBytes 47759419043899
66 # localFreeBytes 85220347674624
67 # localUserBytes 265622218292968
68 # combinedCapacityBytes 136721392009216
69 # combinedDiskBytes 47759419043899
70 # combinedFreeBytes 85220347674624
71 # combinedUserBytes 265622218292968
74 def inventory_storeonce_servicesets(parsed):
75 for values in parsed.itervalues():
76 yield (values["ServiceSet ID"], {})
79 def check_storeonce_servicesets(item, params, parsed):
80 for values in parsed.itervalues():
81 if not item == values["ServiceSet ID"]:
82 continue
84 if "ServiceSet Alias" in values:
85 yield 0, "Alias: %s" % values['ServiceSet Alias']
86 elif "ServiceSet Name" in values:
87 yield 0, "Name: %s" % values['ServiceSet Name']
89 yield 0, "Overall Status: %s, Overall Health: %s" % \
90 (values['Overall Status'], values['Overall Health'])
92 for component in [
93 'ServiceSet Health',
94 'Replication Health',
95 'Housekeeping Health',
97 state = translate_storeonce_status(values["%s Level" % component])
98 state_readable = "%s: %s" % (component, values[component])
99 if state > 0:
100 yield state, state_readable
103 check_info['storeonce_servicesets'] = {
104 'parse_function': parse_storeonce_servicesets,
105 'inventory_function': inventory_storeonce_servicesets,
106 'check_function': check_storeonce_servicesets,
107 'service_description': 'ServiceSet %s Status',
108 'includes': ['storeonce.include'],
112 def inventory_storeonce_servicesets_capacity(parsed):
113 for values in parsed.itervalues():
114 yield (values["ServiceSet ID"], {})
117 def check_storeonce_servicesets_capacity(item, params, parsed):
118 for values in parsed.itervalues():
119 if not item == values["ServiceSet ID"]:
120 continue
121 yield check_storeonce_space(item, params, values)
124 check_info['storeonce_servicesets.capacity'] = {
125 'inventory_function': inventory_storeonce_servicesets_capacity,
126 'check_function': check_storeonce_servicesets_capacity,
127 'service_description': "ServiceSet %s Capacity",
128 'has_perfdata': True,
129 'group': "filesystem",
130 'includes': ["size_trend.include", "df.include", "storeonce.include"],