Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / decru_perf
blobe45e922e2722448a57c0476eaffef1951eb4103a
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.
28 def inventory_decru_perf(info):
29 perf_names = {
30 1: "read (bytes/s)", # readBytesPerSec
31 2: "write (bytes/s)", # writeBytesPerSec
32 3: "operations (/s)", # opsPerSec
33 4: "CIFS read (bytes/s)", # cifs-readBytesPerSec
34 5: "CIFS write (bytes/s)", # cifs-writeBytesPerSec
35 6: "CIFS operations (/s)", # cifs-opsPerSec
36 7: "NFS read (bytes/s)", # nfs-readBytesPerSec
37 8: "NFS write (bytes/s)", # nfs-writeBytesPerSec
38 9: "NFS operations (/s)", # nfs-opsPerSec
41 inventory = []
42 for index, rate in info:
43 def_name = "unknown %s" % index
44 name = perf_names.get(int(index), def_name)
45 item = "%s: %s" % (index, name)
46 inventory.append((item, rate, None))
47 return inventory
50 def check_decru_perf(item, _no_params, info):
51 index, _name = item.split(":", 1)
52 for perf in info:
53 if perf[0] == index:
54 rate = int(perf[1])
55 return (0, "current rate is %d/s" % rate, [("rate", rate)])
57 return (3, "item not found")
60 check_info["decru_perf"] = {
61 'check_function': check_decru_perf,
62 'inventory_function': inventory_decru_perf,
63 'service_description': 'COUNTER %s',
64 'has_perfdata': True,
65 'snmp_info': ('.1.3.6.1.4.1.12962.1.1.2.1.1', [1, 2]),
66 'snmp_scan_function': lambda oid: "datafort" in oid('.1.3.6.1.2.1.1.1.0').lower(),