forked from gmicroul/zabbix-aio-dockerfile-maintenance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl-monitor_zbx_export_templates.yaml
338 lines (334 loc) · 13.1 KB
/
url-monitor_zbx_export_templates.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
zabbix_export:
version: '6.4'
template_groups:
- uuid: 7df96b18c230490a9a0a9e2307226338
name: Templates
templates:
- uuid: d9786e42b7984160b0a1e5cea9f663ee
template: 'URL Monitor'
name: 'URL Monitor'
description: |
Zabbix Template URL Monitor for HTTP Web Servers and SSL Certificates made by InitZero
- HTTP response time
- HTTP response code
- SSL certificate expiration check
Project Page: https://github.com/ugoviti/zabbix-templates/tree/master/url-monitor
version: 20230802
groups:
- name: Templates
discovery_rules:
- uuid: 84fd20a71f45464fbd1694db5df728f9
name: 'URL Discovery'
key: 'url.discovery[url.discovery,{$URL_PATH_CSV}]'
delay: 30m
lifetime: 1d
item_prototypes:
- uuid: b4cc919388b64589bfd195186727fe76
name: '{#ITEMNAME} HTTP response code'
type: DEPENDENT
key: 'http.responseCode[{#URL}]'
delay: '0'
description: 'URL Monitor for: {#URL}'
valuemap:
name: 'HTTP Response codes'
preprocessing:
- type: JSONPATH
parameters:
- '$.data[0].http_code'
master_item:
key: 'url.check[url.monitor,{#URL}]'
tags:
- tag: application
value: url-monitor
- tag: component
value: http
- tag: type
value: response_code
- tag: url
value: '{#ITEMNAME}'
trigger_prototypes:
- uuid: 249c98d582814fe2967216bcffad0128
expression: |
nodata(/URL Monitor/http.responseCode[{#URL}],5m)=1
or
(
min(/URL Monitor/http.responseCode[{#URL}],#3)<>200
and
max(/URL Monitor/http.responseCode[{#URL}],#3)<>200
and
last(/URL Monitor/http.responseCode[{#URL}],#1)<>200
)
name: '{#ITEMNAME} HTTP server error detected'
opdata: '{ITEM.VALUE1}'
url: '{#URL}'
priority: HIGH
description: |
Unable to connect to {#URL}
Last three attempts returned timeout. Please check URL connectivity.
- uuid: 9b0b6bff3b7843b2b24603bbdc84431b
name: '{#ITEMNAME} HTTP response time'
type: DEPENDENT
key: 'http.responseTime[{#URL}]'
delay: '0'
value_type: FLOAT
units: s
description: 'URL Monitor for: {#URL}'
preprocessing:
- type: JSONPATH
parameters:
- '$.data[0].time_total'
master_item:
key: 'url.check[url.monitor,{#URL}]'
tags:
- tag: application
value: url-monitor
- tag: component
value: http
- tag: type
value: response_time
- tag: url
value: '{#ITEMNAME}'
trigger_prototypes:
- uuid: 243a1c43c2ee460eacfb11888af4d18d
expression: 'avg(/URL Monitor/http.responseTime[{#URL}],#3)>{$URL_LATENCY_WARNING}'
name: '{#ITEMNAME} HTTP server high response time detected (> {$URL_LATENCY_WARNING})'
opdata: '{ITEM.VALUE1}'
url: '{#URL}'
priority: WARNING
description: 'Slow replies from {#URL}'
dependencies:
- name: '{#ITEMNAME} HTTP server error detected'
expression: |
nodata(/URL Monitor/http.responseCode[{#URL}],5m)=1
or
(
min(/URL Monitor/http.responseCode[{#URL}],#3)<>200
and
max(/URL Monitor/http.responseCode[{#URL}],#3)<>200
and
last(/URL Monitor/http.responseCode[{#URL}],#1)<>200
)
- uuid: af5c8739fa42454a9d35ffe8ce162412
name: '{#ITEMNAME} SSL expiration date'
type: DEPENDENT
key: 'ssl.timeExpire[{#URL}]'
delay: '0'
units: unixtime
description: 'Check expiry date of SSL certificate for domain {#HOST}:{#PORT}'
preprocessing:
- type: JSONPATH
parameters:
- '$.data[0].ssl_time_expire'
error_handler: DISCARD_VALUE
master_item:
key: 'url.check[url.monitor,{#URL}]'
tags:
- tag: application
value: url-monitor
- tag: component
value: ssl
- tag: type
value: expiration_date
- tag: url
value: '{#ITEMNAME}'
- uuid: 267beca2207546ba9b1c41e5850c6844
name: '{#ITEMNAME} SSL expiration time left'
type: DEPENDENT
key: 'ssl.timeLeft[{#URL}]'
delay: '0'
value_type: FLOAT
units: s
description: 'Check expiry date of SSL certificate for domain {#HOST}:{#PORT}'
preprocessing:
- type: JSONPATH
parameters:
- '$.data[0].ssl_time_left'
error_handler: DISCARD_VALUE
master_item:
key: 'url.check[url.monitor,{#URL}]'
tags:
- tag: application
value: url-monitor
- tag: component
value: ssl
- tag: type
value: expiration_time_left
- tag: url
value: '{#ITEMNAME}'
- uuid: 2067f2c99a114074a922a66c4aee75ea
name: '{#ITEMNAME} Get raw data'
key: 'url.check[url.monitor,{#URL}]'
history: 1h
trends: '0'
value_type: TEXT
description: 'URL Monitor for: {#URL}'
tags:
- tag: application
value: url-monitor
- tag: component
value: raw
- tag: url
value: '{#ITEMNAME}'
trigger_prototypes:
- uuid: da5d3edee6a5400fb77a9fd8b24c68ca
expression: |
nodata(/URL Monitor/ssl.timeExpire[{#URL}],5m)=1
and
nodata(/URL Monitor/http.responseCode[{#URL}],5m)=1
name: '{#ITEMNAME} SSL certificate failed to retrieve'
opdata: '{ITEM.VALUE1}'
url: '{#URL}'
priority: WARNING
description: 'Unable to connect to {#URL}'
- uuid: 435c3b1e7c3140f3b69e7a7344283f0e
expression: |
max(/URL Monitor/ssl.timeExpire[{#URL}],#2)>0
and
max(/URL Monitor/ssl.timeLeft[{#URL}],#2)<0d
name: '{#ITEMNAME} SSL certificate has EXPIRED on {ITEM.VALUE1}'
opdata: 'Expired on: {ITEM.VALUE1} ({ITEM.VALUE2} ago)'
url: '{#URL}'
priority: DISASTER
description: 'SSL Certificate for {#URL} is expired'
dependencies:
- name: '{#ITEMNAME} SSL certificate failed to retrieve'
expression: |
nodata(/URL Monitor/ssl.timeExpire[{#URL}],5m)=1
and
nodata(/URL Monitor/http.responseCode[{#URL}],5m)=1
- uuid: 420919c495584031b8e3e180c92f7df0
expression: |
max(/URL Monitor/ssl.timeExpire[{#URL}],#2)>0
and
max(/URL Monitor/ssl.timeLeft[{#URL}],#2)<{$URL_SSL_EXPIRE_TIME_CRITICAL}
name: '{#ITEMNAME} SSL certificate will expire on {ITEM.VALUE1}'
opdata: 'Will expire on: {ITEM.VALUE1} ({ITEM.VALUE2} remaining)'
url: '{#URL}'
priority: HIGH
description: 'Configured Critical level: {$URL_SSL_EXPIRE_TIME_CRITICAL}'
dependencies:
- name: '{#ITEMNAME} SSL certificate has EXPIRED on {ITEM.VALUE1}'
expression: |
max(/URL Monitor/ssl.timeExpire[{#URL}],#2)>0
and
max(/URL Monitor/ssl.timeLeft[{#URL}],#2)<0d
- uuid: 4bccbaea16d1417abdb9c9aa5732fad4
expression: |
max(/URL Monitor/ssl.timeExpire[{#URL}],#2)>0
and
max(/URL Monitor/ssl.timeLeft[{#URL}],#2)<{$URL_SSL_EXPIRE_TIME_WARNING}
name: '{#ITEMNAME} SSL certificate will expire on {ITEM.VALUE1}'
opdata: 'Will expire on: {ITEM.VALUE1} ({ITEM.VALUE2} remaining)'
url: '{#URL}'
priority: WARNING
description: 'Configured Warning level: {$URL_SSL_EXPIRE_TIME_WARNING}'
dependencies:
- name: '{#ITEMNAME} SSL certificate will expire on {ITEM.VALUE1}'
expression: |
max(/URL Monitor/ssl.timeExpire[{#URL}],#2)>0
and
max(/URL Monitor/ssl.timeLeft[{#URL}],#2)<{$URL_SSL_EXPIRE_TIME_CRITICAL}
graph_prototypes:
- uuid: 007e18b4c84d48e6a0d80a2accf2bf27
name: '{#URL} URL response time'
type: STACKED
graph_items:
- sortorder: '1'
color: 199C0D
item:
host: 'URL Monitor'
key: 'http.responseTime[{#URL}]'
tags:
- tag: class
value: network
- tag: target
value: http
- tag: target
value: ssl
macros:
- macro: '{$URL_LATENCY_WARNING}'
value: 15s
description: 'Default acceptable latency for loading URL (seconds)'
- macro: '{$URL_PATH_CSV}'
value: /etc/zabbix/url-monitor.csv
description: 'URLs CSV file path (http URL or local path)'
- macro: '{$URL_SSL_EXPIRE_TIME_CRITICAL}'
value: 3d
description: 'Critical level for SSL certificate expiration time (days)'
- macro: '{$URL_SSL_EXPIRE_TIME_WARNING}'
value: 7d
description: 'Warning level for SSL certificate expiration time (days)'
dashboards:
- uuid: f8259da7c38546ef84eb8c954a9870f3
name: 'URL Monitor'
auto_start: 'NO'
pages:
- name: 'Web Monitor'
widgets:
- type: graphprototype
name: 'Web URL Monitor'
width: '23'
height: '32'
fields:
- type: INTEGER
name: columns
value: '3'
- type: INTEGER
name: rows
value: '7'
- type: GRAPH_PROTOTYPE
name: graphid
value:
host: 'URL Monitor'
name: '{#URL} URL response time'
- name: 'SSL Monitor'
widgets:
- type: graphprototype
name: 'SSL Monitor'
width: '23'
height: '10'
fields:
- type: INTEGER
name: columns
value: '3'
- type: INTEGER
name: rows
value: '2'
- type: INTEGER
name: source_type
value: '3'
- type: ITEM_PROTOTYPE
name: itemid
value:
host: 'URL Monitor'
key: 'ssl.timeLeft[{#URL}]'
valuemaps:
- uuid: c0606612ff73441ab80bcdcb0f55822a
name: 'HTTP Response codes'
mappings:
- value: '1'
newvalue: 'Unknown Error'
- value: '6'
newvalue: 'Could not resolve host'
- value: '7'
newvalue: 'Failed to connect'
- value: '28'
newvalue: 'Connection timed out'
- value: '60'
newvalue: 'SSL certificate problem'
- value: '200'
newvalue: Ok
- value: '301'
newvalue: 'Moved Permanently'
- value: '302'
newvalue: Found
- value: '303'
newvalue: 'See Other'
- value: '403'
newvalue: Forbidden
- value: '404'
newvalue: 'Not Found'
- value: '500'
newvalue: 'Internal Server Error'
- value: '503'
newvalue: 'Service Unavailable'