2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2017 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.
30 def parse_cisco_asa_conn(info
):
33 parsed
[line
[0]] = [line
[1]]
35 parsed
[line
[0]].append(line
[1])
36 parsed
[line
[0]].append(line
[2])
38 parsed
[line
[0]].append(line
[1])
41 # parsed = { u'4': [u'outside-adsl', u'1', u'1', u'8.8.8.8'] }
45 def inventory_cisco_asa_conn(parsed
):
46 for key
, values
in parsed
.iteritems():
47 if values
[1] == "1" and len(values
) == 4:
51 def check_cisco_asa_conn(item
, _no_params
, parsed
):
58 "6": (2, "not present"),
59 "7": (2, "lower layer down"),
62 for key
, values
in parsed
.iteritems():
64 yield 0, "Name: %s" % values
[0]
66 if not values
[3] == "":
67 yield 0, "IP: %s" % values
[3]
68 else: # CRIT if no IP is assigned
69 yield 2, "IP: Not found!"
71 state
, state_readable
= translate_status
[values
[2]]
72 yield state
, "Status: %s" % state_readable
75 check_info
['cisco_asa_conn'] = {
76 'parse_function' : parse_cisco_asa_conn
,
77 'inventory_function' : inventory_cisco_asa_conn
,
78 'check_function' : check_cisco_asa_conn
,
79 'service_description' : 'Connection %s',
80 'snmp_info' : [('.1.3.6.1.2.1.31.1.1.1', [
84 ('.1.3.6.1.2.1.4.20.1', [
85 "2", # IP-MIB::ipAdEntIfIndex
86 "1", # IP-MIB::ipAdEntAddr
88 ('.1.3.6.1.2.1.2.2.1', [
90 "7", # IF-MIB::ifAdminStatus
91 "8", # IF-MIB::ifOperStatus
93 'snmp_scan_function' : lambda oid
: oid(".1.3.6.1.2.1.1.1.0").lower().startswith("cisco adaptive security") \
94 or "cisco pix security" in oid(".1.3.6.1.2.1.1.1.0").lower(),