Cleanup config.nodes_of
[check_mk.git] / checks / hpux_lunstats
blob993e10dc6ea61160010508ad634f545ad00c9a5e
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 # <<<hpux_lunstats>>>
28 # WWID: 0x600508b1001cf7f0d25c51941cf5e2d7
29 # STATISTICS FOR LUN :/dev/rdisk/disk11
30 # Bytes read : 841717976279
31 # Bytes written : 430393024512
32 # Total I/Os processed : 206684834
33 # I/O failures : 0
34 # Retried I/O failures : 0
35 # I/O failures due to invalid IO size : 0
36 # IO failures due to misallignment or boundary : 0
37 # WWID: 0x60a98000572d44745634645076556357
38 # STATISTICS FOR LUN :/dev/rdisk/disk5
39 # Bytes read : 1035897815087
40 # Bytes written : 113475461120
41 # Total I/Os processed : 23920189
42 # I/O failures : 24
43 # Retried I/O failures : 0
44 # I/O failures due to invalid IO size : 0
45 # IO failures due to misallignment or boundary : 0
46 # WWID: 0x60a98000572d4474563464507665446d
47 # STATISTICS FOR LUN :/dev/rdisk/disk6
50 # Convert info to output needed for generic diskstat check
51 def parse_hpux_lunstats(info):
52 #TODO use 'check_diskstat_dict' which needs the following format
53 # disks = { "sda" : {
54 # 'node' : None,
55 # 'average_read_request_size' : 0.0,
56 # 'average_read_wait' : 0.0,
57 # 'average_request_size' : 40569.90476190476,
58 # 'average_wait' : 0.761904761904762,
59 # 'average_write_request_size' : 40569.90476190476,
60 # 'average_write_wait' : 0.0007619047619047619,
61 # 'read_ios' : 0.0,
62 # 'read_throughput' : 0.0,
63 # 'latency' : 0.00038095238095238096,
64 # 'utilization' : 0.0006153846153846154,
65 # 'write_ios' : 1.6153846153846154,
66 # 'write_throughput' : 65536.0,
67 # 'queue_length' : 0.0,
68 # 'read_ql' : 0.0,
69 # 'write_ql' : 0.0,
70 # }}
71 luns = []
72 for line in info:
73 if len(line) == 2:
74 left = line[0].strip()
75 right = line[1].strip()
76 if left == 'STATISTICS FOR LUN':
77 lun = right
78 elif left == 'Bytes read':
79 bytes_read = int(right) / 512
80 elif left == 'Bytes written':
81 bytes_written = int(right) / 512
82 luns.append((None, lun, bytes_read, bytes_written))
83 return luns
86 def check_hpux_lunstats(item, params, parsed):
87 return check_diskstat_generic(item, params, time.time(), parsed)
90 check_info["hpux_lunstats"] = {
91 'parse_function': parse_hpux_lunstats,
92 'check_function': check_hpux_lunstats,
93 'inventory_function': inventory_diskstat_generic,
94 'service_description': 'Disk IO %s',
95 'has_perfdata': True,
96 'group': 'disk_io',
97 'includes': ["diskstat.include"],