Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / f5_bigip_mem
blobc1d9c528656157d6ac39ff60b5f041d9e1fa61ff
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 # Example output:
28 # Overall memory
29 # .1.3.6.1.4.1.3375.2.1.7.1.1.0 8396496896 sysHostMemoryTotal
30 # .1.3.6.1.4.1.3375.2.1.7.1.2.0 1331092416 sysHostMemoryUsed
32 # TMM (Traffic Management Module) memory
33 # .1.3.6.1.4.1.3375.2.1.1.2.1.44.0 0 sysStatMemoryTotal
34 # .1.3.6.1.4.1.3375.2.1.1.2.1.45.0 0 sysStatMemoryUsed
36 factory_settings["f5_bigip_mem_default_levels"] = {"levels": ("perc_used", (80.0, 90.0))}
39 def parse_f5_bigip_mem(info):
40 parsed = {
41 "mem": (info[0][0], info[0][1]),
42 "tmm": (info[0][2], info[0][3]),
44 return parsed
47 def inventory_f5_bigip_mem(parsed):
48 return [("total", {})]
51 def check_f5_bigip_mem(item, params, parsed):
52 mem_total, mem_used = parsed["mem"]
53 return check_memory_simple(float(mem_used), float(mem_total), params)
56 check_info['f5_bigip_mem'] = {
57 'parse_function': parse_f5_bigip_mem,
58 'inventory_function': inventory_f5_bigip_mem,
59 'check_function': check_f5_bigip_mem,
60 'service_description': 'Memory',
61 'has_perfdata': True,
62 'snmp_info': (
63 ".1.3.6.1.4.1.3375.2.1",
65 "7.1.1", # F5-BIGIP-SYSTEM-MIB::sysHostMemoryTotal
66 "7.1.2", # F5-BIGIP-SYSTEM-MIB::sysHostMemoryUsed
67 "1.2.1.143", # F5-BIGIP-SYSTEM-MIB::sysStatMemoryTotalKb
68 "1.2.1.144", # F5-BIGIP-SYSTEM-MIB::sysStatMemoryUsedKb
69 ]),
70 'snmp_scan_function': lambda oid: ".1.3.6.1.4.1.3375" in oid(".1.3.6.1.2.1.1.2.0"),
71 'default_levels_variable': 'f5_bigip_mem_default_levels',
72 'group': 'memory_simple',
73 'includes': ["memory.include"],
77 def inventory_f5_bigip_mem_tmm(parsed):
78 mem = parsed["tmm"][0]
79 # Some devices obviously do not deliver this information...
80 if mem != '' and float(mem) != 0:
81 return [("TMM", {})]
84 def check_f5_bigip_mem_tmm(item, params, parsed):
85 mem_total, mem_used = parsed["tmm"]
86 return check_memory_simple(float(mem_used) * 1024, float(mem_total) * 1024, params)
89 check_info['f5_bigip_mem.tmm'] = {
90 'inventory_function': inventory_f5_bigip_mem_tmm,
91 'check_function': check_f5_bigip_mem_tmm,
92 'service_description': 'Memory',
93 'has_perfdata': True,
94 'default_levels_variable': 'f5_bigip_mem_default_levels',
95 'group': 'memory_simple',
96 'includes': ["memory.include"],