Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / moxa_iologik_register
blob132e45cce04decf00aae57dcb47989b53c90c206
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 # "0=Off, 1=On in DI/DO mode or N=Count in DO counter mode"
30 def inventory_iologik_register(info):
31 inventory = []
32 for line in info:
33 if line[2]:
34 inventory.append((line[0], None))
35 return inventory
38 def check_iologik_register(item, params, info):
39 for line in info:
40 if line[0] == item:
41 if int(line[2]) in range(0, 2):
42 return (int(line[2]), line[1])
43 return (3, "Invalid value %s for register" % line[2])
45 return (3, "Register not found")
48 check_info['moxa_iologik_register'] = {
49 "check_function" : check_iologik_register,
50 "inventory_function" : inventory_iologik_register,
51 "service_description" : "Moxa Register",
52 "group" : "iologik_register",
53 "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.8691.") and
54 oid(".1.3.6.1.4.1.8691.10.2242.2.0", "").startswith("E2242-T"),
55 "snmp_info" : (".1.3.6.1.4.1.8691.10.2242.10.4.1.1",
56 [ "1", # index
57 "2", # Name
58 "3", # Value
62 # DIOEntry
63 # dioIndex Integer32 (0..11) "The channel dio index."
64 # dioType Integer32 (0..1) "The channel dio type. 0=DI, DO=1, AI=2"
65 # dioMode Integer32 (0..1) "The channel dio mode. 0=DI, 1=Event Counter"
66 # dioStatus Unsigned32 (0..4294967295) "The channel dio(di/do) status. 0=Off, 1=On in DI/DO mode or N=Count in DO counter mode
67 # dioFilter Integer32 (1..65535) "The channel dio(di) counter filter. unit=0.5ms"
68 # dioTrigger Integer32 (0..1) "The channel dio(di) counter trigger level. 0=L2H, 1=H2L"
69 # dioCntStart Integer32 (0..1) "The channel dio(do) counter start/stop. 0=stop, 1=start"
70 # dioPulseStart Integer32 (0..1) "The channel dio(do) pulse start/stop. 0=stop, 1=start"
71 # dioPulseONWidth Unsigned32 (1..4294967295) "The channel dio(do) signal ON width. unit=0.5ms"
72 # dioPulseOFFWidth Unsigned32 (1..4294967295) "The channel dio(do) signal OFF width. unit=0.5ms"