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.
28 def parse_safenet_ntls(info
):
30 "operation_status": info
[0][0],
31 "connected_clients": int(info
[0][1]),
32 "links": int(info
[0][2]),
33 "successful_connections": int(info
[0][3]),
34 "failed_connections": int(info
[0][4]),
35 "expiration_date": info
[0][5],
40 # .--Connection rate-----------------------------------------------------.
42 # | / ___|___ _ __ _ __ ___ ___| |_(_) ___ _ __ |
43 # | | | / _ \| '_ \| '_ \ / _ \/ __| __| |/ _ \| '_ \ |
44 # | | |__| (_) | | | | | | | __/ (__| |_| | (_) | | | | |
45 # | \____\___/|_| |_|_| |_|\___|\___|\__|_|\___/|_| |_| |
48 # | _ __ __ _| |_ ___ |
49 # | | '__/ _` | __/ _ \ |
50 # | | | | (_| | || __/ |
51 # | |_| \__,_|\__\___| |
53 # '----------------------------------------------------------------------'
56 def inventory_safenet_ntls_connrate(parsed
):
58 yield "successful", None
62 def check_safenet_ntls_connrate(item
, _no_params
, parsed
):
64 connections_rate
= get_rate(item
, now
, parsed
[item
+ "_connections"])
65 perfdata
= [("connections_rate", connections_rate
)]
66 return 0, "%.2f connections/s" % connections_rate
, perfdata
69 check_info
["safenet_ntls.connrate"] = {
70 "inventory_function": inventory_safenet_ntls_connrate
,
71 "check_function": check_safenet_ntls_connrate
,
72 "service_description": "NTLS Connection Rate: %s",
77 # .--Expiration date-----------------------------------------------------.
79 # | | ____|_ ___ __ (_)_ __ __ _| |_(_) ___ _ __ |
80 # | | _| \ \/ / '_ \| | '__/ _` | __| |/ _ \| '_ \ |
81 # | | |___ > <| |_) | | | | (_| | |_| | (_) | | | | |
82 # | |_____/_/\_\ .__/|_|_| \__,_|\__|_|\___/|_| |_| |
85 # | __| | __ _| |_ ___ |
86 # | / _` |/ _` | __/ _ \ |
87 # | | (_| | (_| | || __/ |
88 # | \__,_|\__,_|\__\___| |
90 # '----------------------------------------------------------------------'
93 def inventory_safenet_ntls_expiration(parsed
):
98 def check_safenet_ntls_expiration(_no_item
, _no_params
, parsed
):
99 return 0, "The NTLS server certificate expires on " + parsed
["expiration_date"]
102 check_info
["safenet_ntls.expiration"] = {
103 "inventory_function": inventory_safenet_ntls_expiration
,
104 "check_function": check_safenet_ntls_expiration
,
105 "service_description": "NTLS Expiration Date",
109 # .--Links---------------------------------------------------------------.
111 # | | | (_)_ __ | | _____ |
112 # | | | | | '_ \| |/ / __| |
113 # | | |___| | | | | <\__ \ |
114 # | |_____|_|_| |_|_|\_\___/ |
116 # '----------------------------------------------------------------------'
119 def inventory_safenet_ntls_links(parsed
):
121 return [(None, None)]
124 def check_safenet_ntls_links(_no_item
, params
, parsed
):
126 parsed
["links"], "connections", params
, unit
='links', infoname
="Connections")
129 check_info
["safenet_ntls.links"] = {
130 "inventory_function": inventory_safenet_ntls_links
,
131 "check_function": check_safenet_ntls_links
,
132 "service_description": "NTLS Links",
133 "has_perfdata": True,
134 "group": "safenet_ntls_links",
138 # .--Connected clients---------------------------------------------------.
140 # | / ___|___ _ __ _ __ ___ ___| |_ ___ __| | |
141 # | | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \/ _` | |
142 # | | |__| (_) | | | | | | | __/ (__| || __/ (_| | |
143 # | \____\___/|_| |_|_| |_|\___|\___|\__\___|\__,_| |
146 # | ___| (_) ___ _ __ | |_ ___ |
147 # | / __| | |/ _ \ '_ \| __/ __| |
148 # | | (__| | | __/ | | | |_\__ \ |
149 # | \___|_|_|\___|_| |_|\__|___/ |
151 # '----------------------------------------------------------------------'
154 def inventory_safenet_ntls_clients(parsed
):
156 return [(None, None)]
159 def check_safenet_ntls_clients(_no_item
, params
, parsed
):
161 parsed
["connected_clients"],
164 unit
='connected clients',
165 infoname
="Connections")
168 check_info
["safenet_ntls.clients"] = {
169 "inventory_function": inventory_safenet_ntls_clients
,
170 "check_function": check_safenet_ntls_clients
,
171 "service_description": "NTLS Clients",
172 "has_perfdata": True,
173 "group": "safenet_ntls_clients",
177 # .--Operation status----------------------------------------------------.
179 # | / _ \ _ __ ___ _ __ __ _| |_(_) ___ _ __ |
180 # | | | | | '_ \ / _ \ '__/ _` | __| |/ _ \| '_ \ |
181 # | | |_| | |_) | __/ | | (_| | |_| | (_) | | | | |
182 # | \___/| .__/ \___|_| \__,_|\__|_|\___/|_| |_| |
185 # | ___| |_ __ _| |_ _ _ ___ |
186 # | / __| __/ _` | __| | | / __| |
187 # | \__ \ || (_| | |_| |_| \__ \ |
188 # | |___/\__\__,_|\__|\__,_|___/ |
190 # '----------------------------------------------------------------------'
193 def inventory_safenet_ntls(parsed
):
195 return [(None, None)]
198 def check_safenet_ntls(_no_item
, _no_params
, parsed
):
199 operation_status
= parsed
["operation_status"]
200 if operation_status
== "1":
202 elif operation_status
== "2":
204 elif operation_status
== "3":
208 check_info
["safenet_ntls"] = {
209 "parse_function": parse_safenet_ntls
,
210 "inventory_function": inventory_safenet_ntls
,
211 "check_function": check_safenet_ntls
,
212 "service_description": "NTLS Operation Status",
213 "snmp_scan_function": lambda oid
: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.12383"),
215 ".1.3.6.1.4.1.12383.3.1.2",
217 "1", # ntlsOperStatus
218 "2", # ntlsConnectedClients
220 "4", # ntlsSuccessfulClientConnections
221 "5", # ntlsFailedClientConnections
222 "6", # ntlsCertExpireDay