Cleanup config.nodes_of
[check_mk.git] / checks / ucd_disk
blob94bf638ecbd8cd228b3037a549bcb85da5b91ff5
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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.2021.9.1.2.1 / --> UCD-SNMP-MIB::dskPath.1
28 # .1.3.6.1.4.1.2021.9.1.6.1 958827968 --> UCD-SNMP-MIB::dskTotal.1
29 # .1.3.6.1.4.1.2021.9.1.7.1 55330132 --> UCD-SNMP-MIB::dskAvail.1
32 def inventory_ucd_disk(info):
33 return [(line[0], {}) for line in info]
36 def check_ucd_disk(item, params, info):
37 for disk_path, disk_total_str, disk_avail_str in info:
38 if disk_path == item:
39 disk_total_mb = float(disk_total_str) / 1024
40 disk_avail_mb = float(disk_avail_str) / 1024
41 return df_check_filesystem_single(item, disk_total_mb, disk_avail_mb, 0, None, None,
42 params)
45 check_info['ucd_disk'] = {
46 'inventory_function': inventory_ucd_disk,
47 'check_function': check_ucd_disk,
48 'service_description': 'Filesystem %s',
49 'has_perfdata': True,
50 'snmp_info': (
51 ".1.3.6.1.4.1.2021.9.1",
53 "2", # dskPath -> where the disk is mounted.
54 "6", # dskTotal -> in kBytes
55 "7", # dskAvail -> in kBytes
56 ]),
57 'snmp_scan_function': prefer_hr_else_ucd,
58 "group": "filesystem",
59 'default_levels_variable': "filesystem_default_levels",
60 'includes': ["ucd_hr.include", "size_trend.include", "df.include"],