Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / hitachi_hnas_span
blob72705833c02d54fe74c4c59b59c9cedea44d9cfa
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 check_includes["hitachi_hnas_span"] = ["size_trend.include", "df.include"]
30 def inventory_hitachi_hnas_span(info):
31 mplist = []
32 for id_, label, _total_upper, _total_lower, _used_upper, _used_lower in info:
33 mplist.append(id_ + " " + label)
34 return df_inventory(mplist)
37 def check_hitachi_hnas_span(item, params, info):
38 fslist = []
39 for id_, label, total_upper, total_lower, used_upper, used_lower in info:
40 if id_ + " " + label == item:
41 size_mb = (int(total_upper) * 2**32 + int(total_lower)) / 1048576.0
42 used_mb = (int(used_upper) * 2**32 + int(used_lower)) / 1048576.0
43 avail_mb = size_mb - used_mb
44 fslist.append((item, size_mb, avail_mb, 0))
46 return df_check_filesystem_list(item, params, fslist)
48 return 3, "Span %s not found" % item
51 check_info["hitachi_hnas_span"] = {
52 "check_function": check_hitachi_hnas_span,
53 "inventory_function": inventory_hitachi_hnas_span,
54 "service_description": "Span %s",
55 "has_perfdata": True,
56 "snmp_info": (".1.3.6.1.4.1.11096.6.1.1.6.4.2.1", [1, 2, 3, 4, 5, 6]),
57 # spanStatsSpanId, spanLabel, spanCapacityTotalUpper, spanCapacityTotalLower,
58 # spanCapacityUsedUpper, spanCapacityUsedLower
59 "snmp_scan_function": hitachin_hnas_scan_function,
60 "group": "filesystem",
61 "default_levels_variable": "filesystem_default_levels",
62 "includes": ["size_trend.include", "hitachi_hnas.include"],