Refactored snapin server_time to new snapin API
[check_mk.git] / checks / vms_system
blobee34e848c8a4800d565de9ff08cefb445333c269
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 # Example output from agent
28 # Columns:
29 # 1. Direct IOs / sec (on hardware)
30 # 2. Buffered IOs / sec (queued)
31 # 3. Number of currently existing processes (averaged)
33 # <<<vms_system>>>
34 # 0.00 0.00 15.00
36 def inventory_vms_system(info):
37 if len(info) > 0:
38 return [(None, None)]
40 def check_vms_system_ios(_no_item, _no_params, info):
41 direct_ios, buffered_ios = map(float, info[0][:2])
42 return (0, "Direct IOs: %.2f/sec, Buffered IOs: %.2f/sec" % (
43 direct_ios, buffered_ios), [ ("direct", direct_ios), ("buffered", buffered_ios)])
45 check_info["vms_system.ios"] = {
46 "check_function" : check_vms_system_ios,
47 "inventory_function" : inventory_vms_system,
48 "service_description" : "IOs",
49 "has_perfdata" : True,
52 def check_vms_system_procs(_no_item, params, info):
53 procs = int(float(info[0][2]))
54 perfdata = [('procs', procs, 0, 0, 0 )]
56 if params:
57 warn, crit = params
58 perfdata = [('procs', procs, warn, crit, 0 )]
59 if procs >= crit:
60 return (2, "%d processes (critical at %d)" % (procs, crit), perfdata)
61 elif procs >= warn:
62 return (1, "%d processes (warning at %d)" % (procs, warn), perfdata)
64 return (0, "%d processes" % (procs,), perfdata)
67 check_info["vms_system.procs"] = {
68 "check_function" : check_vms_system_procs,
69 "inventory_function" : inventory_vms_system,
70 "service_description" : "Number of processes",
71 "has_perfdata" : True,
72 "group" : "vms_procs",