forked from kulpin74/zabbix-ssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplate SSL check LLD.xml
236 lines (236 loc) · 11.6 KB
/
Template SSL check LLD.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.4</version>
<date>2020-04-12T17:07:41Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template SSL check LLD</template>
<name>Template SSL check LLD</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Domain checks</name>
</application>
<application>
<name>HTTPS Service</name>
</application>
<application>
<name>SSL Checks</name>
</application>
</applications>
<discovery_rules>
<discovery_rule>
<name>Domains discovery</name>
<type>EXTERNAL</type>
<key>list.sh["ssl_check.json","1"]</key>
<delay>1h</delay>
<lifetime>60d</lifetime>
<item_prototypes>
<item_prototype>
<name>Domain {#DOMAIN_NAME} expire in</name>
<type>EXTERNAL</type>
<key>whois_expire.sh[{#DOMAIN_NAME}]</key>
<delay>1d</delay>
<trends>730d</trends>
<units>day(s)</units>
<applications>
<application>
<name>Domain checks</name>
</application>
</applications>
<trigger_prototypes>
<trigger_prototype>
<expression>{last()}<=0</expression>
<name>Domain {#DOMAIN_NAME} expired</name>
<priority>DISASTER</priority>
</trigger_prototype>
<trigger_prototype>
<expression>{last()}<14</expression>
<name>Domain {#DOMAIN_NAME} will expire in 14 days</name>
<priority>HIGH</priority>
<dependencies>
<dependency>
<name>Domain {#DOMAIN_NAME} expired</name>
<expression>{Template SSL check LLD:whois_expire.sh[{#DOMAIN_NAME}].last()}<=0</expression>
</dependency>
</dependencies>
</trigger_prototype>
<trigger_prototype>
<expression>{last()}<30</expression>
<name>Domain {#DOMAIN_NAME} will expire in 30 days</name>
<priority>WARNING</priority>
<dependencies>
<dependency>
<name>Domain {#DOMAIN_NAME} will expire in 14 days</name>
<expression>{Template SSL check LLD:whois_expire.sh[{#DOMAIN_NAME}].last()}<14</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
</item_prototypes>
<lld_macro_paths>
<lld_macro_path>
<lld_macro>{#DOMAIN_NAME}</lld_macro>
<path>$.d_name</path>
</lld_macro_path>
</lld_macro_paths>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>var urls = JSON.parse(value);
var dom_names = [];
for (var i = 0; i < urls.length; i++) {
var j = urls[i].url.split('.');
var dn = j[j.length - 2] + '.' + j[j.length - 1];
if (dom_names.indexOf(dn) == -1) {
dom_names.push(dn);
}
}
var dnames = [];
for (var i = 0; i < dom_names.length; i++) {
dnames.push({'d_name': dom_names[i]});
}
return JSON.stringify(dnames);</params>
</step>
</preprocessing>
</discovery_rule>
<discovery_rule>
<name>URLs discovery</name>
<type>EXTERNAL</type>
<key>list.sh["ssl_check.json"]</key>
<delay>1h</delay>
<lifetime>60d</lifetime>
<item_prototypes>
<item_prototype>
<name>HTTPS Service on {#URL}:{#PORT} is running</name>
<type>SIMPLE</type>
<key>net.tcp.service[https,{#URL},{#PORT}]</key>
<delay>5m</delay>
<history>10d</history>
<trends>730d</trends>
<applications>
<application>
<name>HTTPS Service</name>
</application>
</applications>
<valuemap>
<name>Service state</name>
</valuemap>
<trigger_prototypes>
<trigger_prototype>
<expression>{max(#3)}=0</expression>
<name>HTTPS service is down on {#URL}:{#PORT}</name>
<priority>AVERAGE</priority>
<description>Last value: {ITEM.LASTVALUE1}.
HTTPS service is down on {#URL}:{#PORT}</description>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>SSL certificate validity {#URL}:{#PORT}</name>
<type>EXTERNAL</type>
<key>zext_ssl_cert.sh[-d,{#URL},{#PORT}]</key>
<delay>1h</delay>
<history>10d</history>
<trends>730d</trends>
<units>day(s)</units>
<applications>
<application>
<name>SSL Checks</name>
</application>
</applications>
<trigger_prototypes>
<trigger_prototype>
<expression>{nodata(210m)}=1</expression>
<name>Failed to establish SSL connection on {#URL}:{#PORT} in last 3 hours</name>
<status>DISABLED</status>
<priority>HIGH</priority>
</trigger_prototype>
<trigger_prototype>
<expression>{last()}<0</expression>
<name>SSL certificate on {#URL}:{#PORT} expired</name>
<priority>DISASTER</priority>
</trigger_prototype>
<trigger_prototype>
<expression>{last()}<7</expression>
<name>SSL certificate on {#URL}:{#PORT} expires in less than 7 days</name>
<priority>HIGH</priority>
<description>Last value: {ITEM.LASTVALUE1}.
SSL certificate on {#URL}:{#PORT} expires in less than week</description>
<dependencies>
<dependency>
<name>SSL certificate on {#URL}:{#PORT} expired</name>
<expression>{Template SSL check LLD:zext_ssl_cert.sh[-d,{#URL},{#PORT}].last()}<0</expression>
</dependency>
</dependencies>
</trigger_prototype>
<trigger_prototype>
<expression>{last()}<21</expression>
<name>SSL certificate on {#URL}:{#PORT} expires in less than 21 days</name>
<priority>WARNING</priority>
<description>Last value: {ITEM.LASTVALUE1}.
SSL certificate on {#URL}:{#PORT} expires in less than 3 week</description>
<dependencies>
<dependency>
<name>SSL certificate on {#URL}:{#PORT} expires in less than 7 days</name>
<expression>{Template SSL check LLD:zext_ssl_cert.sh[-d,{#URL},{#PORT}].last()}<7</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>SSL certificate issuer {#URL}:{#PORT}</name>
<type>EXTERNAL</type>
<key>zext_ssl_cert.sh[-i,{#URL},{#PORT}]</key>
<delay>1h</delay>
<history>10d</history>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>SSL Checks</name>
</application>
</applications>
</item_prototype>
</item_prototypes>
<lld_macro_paths>
<lld_macro_path>
<lld_macro>{#PORT}</lld_macro>
<path>$.port</path>
</lld_macro_path>
<lld_macro_path>
<lld_macro>{#URL}</lld_macro>
<path>$.url</path>
</lld_macro_path>
</lld_macro_paths>
</discovery_rule>
</discovery_rules>
</template>
</templates>
<value_maps>
<value_map>
<name>Service state</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Down</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Up</newvalue>
</mapping>
</mappings>
</value_map>
</value_maps>
</zabbix_export>