Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / arbor_peakflow_sp
blob0ad6522011f9c1f7a0a57fc92c24e83235435fbd
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.9694.1.4.2.1.1.0 796 --> PEAKFLOW-SP-MIB::deviceCpuLoadAvg1min.0
28 # .1.3.6.1.4.1.9694.1.4.2.1.2.0 742 --> PEAKFLOW-SP-MIB::deviceCpuLoadAvg5min.0
29 # .1.3.6.1.4.1.9694.1.4.2.1.3.0 742 --> PEAKFLOW-SP-MIB::deviceCpuLoadAvg15min.0
30 # .1.3.6.1.4.1.9694.1.4.2.1.4.0 0 --> PEAKFLOW-SP-MIB::deviceDiskUsage.0
31 # .1.3.6.1.4.1.9694.1.4.2.1.5.0 32864948 --> PEAKFLOW-SP-MIB::devicePhysicalMemory.0
32 # .1.3.6.1.4.1.9694.1.4.2.1.6.0 4793660 --> PEAKFLOW-SP-MIB::devicePhysicalMemoryInUse.0
33 # .1.3.6.1.4.1.9694.1.4.2.1.7.0 15 --> PEAKFLOW-SP-MIB::devicePhysicalMemoryUsage.0
34 # .1.3.6.1.4.1.9694.1.4.2.1.8.0 4892156 --> PEAKFLOW-SP-MIB::deviceSwapSpace.0
35 # .1.3.6.1.4.1.9694.1.4.2.1.9.0 0 --> PEAKFLOW-SP-MIB::deviceSwapSpaceInUse.0
36 # .1.3.6.1.4.1.9694.1.4.2.1.10.0 0 --> PEAKFLOW-SP-MIB::deviceSwapSpaceUsage.0
37 # .1.3.6.1.4.1.9694.1.4.2.1.11.0 0 --> PEAKFLOW-SP-MIB::deviceTotalFlows.0
38 # .1.3.6.1.4.1.9694.1.4.2.1.12.0 0 --> PEAKFLOW-SP-MIB::deviceTotalFlowsHC.0
41 def parse_peakflow_sp(info):
42 valid = info[0]
43 res = {'cpu_loads': valid[:3], 'disk': valid[3], 'memory': valid[4:6]}
44 if valid[6]:
45 # this value appears to be optional
46 res['flows'] = valid[6]
48 return res
51 check_info["arbor_peakflow_sp"] = {
52 "check_function": check_arbor_memory,
53 "inventory_function": inventory_arbor_memory,
54 "parse_function": parse_peakflow_sp,
55 "service_description": "Memory",
56 "has_perfdata": True,
57 "group": "memory_arbor",
58 'default_levels_variable': 'arbor_memory_default_levels',
59 "snmp_info": (
60 ".1.3.6.1.4.1.9694.1.4.2.1",
62 "1.0", # deviceCpuLoadAvg1min
63 "2.0", # deviceCpuLoadAvg5min
64 "3.0", # deviceCpuLoadAvg15min
65 "4.0", # deviceDiskUsage
66 "7.0", # devicePhysicalMemoryUsage
67 "10.0", # deviceSwapSpaceUsage
68 "12.0", # deviceTotalFlowsHC
69 ]),
70 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.1.0").startswith("Peakflow SP"),
71 "includes": ["arbor.include"]
74 check_info["arbor_peakflow_sp.cpu_load"] = {
75 "check_function": check_arbor_cpu_load,
76 "inventory_function": inventory_arbor_cpu_load,
77 "service_description": "CPU load",
78 "has_perfdata": True,
79 "group": "cpu_load",
80 "includes": ["cpu_load.include"],
83 check_info["arbor_peakflow_sp.disk_usage"] = {
84 "check_function": check_arbor_disk_usage,
85 "inventory_function": inventory_arbor_disk_usage,
86 "service_description": "Disk Usage %s",
87 "has_perfdata": True,
88 "group": "filesystem",
89 "default_levels_variable": "filesystem_default_levels",
93 def inventory_arbor_peakflow_sp_flows(parsed):
94 if "flows" in parsed:
95 return [(None, None)]
98 def check_arbor_peakflow_sp_flows(no_item, params, parsed):
99 flows = int(parsed['flows'])
100 return 0, "%d flows" % flows, [("flows", flows)]
103 check_info["arbor_peakflow_sp.flows"] = {
104 "check_function": check_arbor_peakflow_sp_flows,
105 "inventory_function": inventory_arbor_peakflow_sp_flows,
106 "service_description": "Flow Count",
107 "has_perfdata": True,