Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / genua_vpn
blob99c7bd5fde582a5cefd76aae14e948cd4c41edc2
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.3717.2.1.3.1.1.1 1
28 # .1.3.6.1.4.1.3717.2.1.3.1.1.2 2
29 # .1.3.6.1.4.1.3717.2.1.3.1.1.3 3
30 # .1.3.6.1.4.1.3717.2.1.3.1.1.4 4
31 # .1.3.6.1.4.1.3717.2.1.3.1.2.1 gc2.momatec.de
32 # .1.3.6.1.4.1.3717.2.1.3.1.2.2 gc1-bsge.vrznrw.de
33 # .1.3.6.1.4.1.3717.2.1.3.1.2.3 gc1-bochum.vrznrw.de
34 # .1.3.6.1.4.1.3717.2.1.3.1.2.4 gc1-hamm.vrznrw.de
35 # .1.3.6.1.4.1.3717.2.1.3.1.3.1
36 # .1.3.6.1.4.1.3717.2.1.3.1.3.2 10.99.15.250
37 # .1.3.6.1.4.1.3717.2.1.3.1.3.3 10.99.13.250
38 # .1.3.6.1.4.1.3717.2.1.3.1.3.4 10.99.14.250
39 # .1.3.6.1.4.1.3717.2.1.3.1.4.1 172.30.230.24/32
40 # .1.3.6.1.4.1.3717.2.1.3.1.4.2 172.30.230.24/32
41 # .1.3.6.1.4.1.3717.2.1.3.1.4.3 172.30.230.24/32
42 # .1.3.6.1.4.1.3717.2.1.3.1.4.4 172.30.230.24/32
43 # .1.3.6.1.4.1.3717.2.1.3.1.5.1 192.168.100.0/24
44 # .1.3.6.1.4.1.3717.2.1.3.1.5.2 10.100.15.0/24
45 # .1.3.6.1.4.1.3717.2.1.3.1.5.3 10.100.13.0/24
46 # .1.3.6.1.4.1.3717.2.1.3.1.5.4 10.100.14.0/24
47 # .1.3.6.1.4.1.3717.2.1.3.1.6.1 2
48 # .1.3.6.1.4.1.3717.2.1.3.1.6.2 2
49 # .1.3.6.1.4.1.3717.2.1.3.1.6.3 2
50 # .1.3.6.1.4.1.3717.2.1.3.1.6.4 2
53 def inventory_genua_vpn(info):
54 return [(line[0], None) for line in info]
57 def check_genua_vpn(item, params, info):
58 for vpn_id, hostname_opposite, ip_opposite, vpn_private, vpn_remote, vpn_state in info:
59 if vpn_id == item:
60 ip_info = ""
61 if ip_opposite:
62 ip_info += " (%s)" % ip_opposite
64 infotext = "Hostname: %s%s, VPN private: %s, VPN remote: %s" % \
65 (hostname_opposite, ip_info, vpn_private, vpn_remote)
67 if vpn_state == '2':
68 return 0, "Connected, %s" % infotext
69 return 2, "Disconnected, %s" % infotext
72 check_info['genua_vpn'] = {
73 'inventory_function': inventory_genua_vpn,
74 'check_function': check_genua_vpn,
75 'service_description': 'VPN %s',
76 'snmp_info': (
77 ".1.3.6.1.4.1.3717.2.1.3.1",
79 "1", # vpn id
80 "2", # hostname opposite
81 "3", # ip opposite
82 "4", # vpn private
83 "5", # vpn remote
84 "6", # vpn status (2:OK, 1:FAULT)
85 ]),
86 "snmp_scan_function": scan_genua,
87 "includes": ["genua.include"],