-
Notifications
You must be signed in to change notification settings - Fork 128
/
Template App Nginx by HTTP.xml
610 lines (610 loc) · 27 KB
/
Template App Nginx by HTTP.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
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<groups>
<group>
<name>Templates/Applications</name>
</group>
</groups>
<templates>
<template>
<template>Template App Nginx by HTTP</template>
<name>Template App Nginx by HTTP</name>
<description>Get metrics from stub status module using HTTP agent
https://nginx.ru/en/docs/http/ngx_http_stub_status_module.html.
You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384765-discussion-thread-for-official-zabbix-template-nginx
Template tooling version used: 0.37</description>
<groups>
<group>
<name>Templates/Applications</name>
</group>
</groups>
<applications>
<application>
<name>Nginx</name>
</application>
<application>
<name>Zabbix raw items</name>
</application>
</applications>
<items>
<item>
<name>Nginx: Service response time</name>
<type>SIMPLE</type>
<key>net.tcp.service.perf[http,"{HOST.CONN}","{$NGINX.STUB_STATUS.PORT}"]</key>
<history>7d</history>
<value_type>FLOAT</value_type>
<units>s</units>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<triggers>
<trigger>
<expression>{min(5m)}>{$NGINX.RESPONSE_TIME.MAX.WARN}</expression>
<name>Nginx: Service response time is too high (over {$NGINX.RESPONSE_TIME.MAX.WARN}s for 5m)</name>
<priority>WARNING</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>Nginx: Service is down</name>
<expression>{Template App Nginx by HTTP:net.tcp.service[http,"{HOST.CONN}","{$NGINX.STUB_STATUS.PORT}"].last()}=0</expression>
</dependency>
</dependencies>
</trigger>
</triggers>
</item>
<item>
<name>Nginx: Service status</name>
<type>SIMPLE</type>
<key>net.tcp.service[http,"{HOST.CONN}","{$NGINX.STUB_STATUS.PORT}"]</key>
<history>7d</history>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<valuemap>
<name>Service state</name>
</valuemap>
<preprocessing>
<step>
<type>DISCARD_UNCHANGED_HEARTBEAT</type>
<params>10m</params>
</step>
</preprocessing>
<triggers>
<trigger>
<expression>{last()}=0</expression>
<name>Nginx: Service is down</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger>
</triggers>
</item>
<item>
<name>Nginx: Connections accepted per second</name>
<type>DEPENDENT</type>
<key>nginx.connections.accepted.rate</key>
<delay>0</delay>
<history>7d</history>
<value_type>FLOAT</value_type>
<description>The total number of accepted client connections.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
\1</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Connections active</name>
<type>DEPENDENT</type>
<key>nginx.connections.active</key>
<delay>0</delay>
<history>7d</history>
<description>The current number of active client connections including Waiting connections.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>Active connections: ([0-9]+)
\1</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Connections dropped per second</name>
<type>DEPENDENT</type>
<key>nginx.connections.dropped.rate</key>
<delay>0</delay>
<history>7d</history>
<value_type>FLOAT</value_type>
<description>The total number of dropped client connections.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>var a = value.match(/server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)/)
if (a) {
return a[1]-a[2]
}</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
<triggers>
<trigger>
<expression>{min(5m)} > {$NGINX.DROP_RATE.MAX.WARN}</expression>
<name>Nginx: High connections drop rate (more than {$NGINX.DROP_RATE.MAX.WARN} for 5m)</name>
<opdata>Current rate: {ITEM.LASTVALUE1}</opdata>
<priority>WARNING</priority>
<description>The dropping rate connections is greater than {$NGINX.DROP_RATE.MAX.WARN} for the last 5 minutes.</description>
<dependencies>
<dependency>
<name>Nginx: Service is down</name>
<expression>{Template App Nginx by HTTP:net.tcp.service[http,"{HOST.CONN}","{$NGINX.STUB_STATUS.PORT}"].last()}=0</expression>
</dependency>
</dependencies>
</trigger>
</triggers>
</item>
<item>
<name>Nginx: Connections handled per second</name>
<type>DEPENDENT</type>
<key>nginx.connections.handled.rate</key>
<delay>0</delay>
<history>7d</history>
<value_type>FLOAT</value_type>
<description>The total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached (for example, the worker_connections limit).</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
\2</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Connections reading</name>
<type>DEPENDENT</type>
<key>nginx.connections.reading</key>
<delay>0</delay>
<history>7d</history>
<description>The current number of connections where nginx is reading the request header.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)
\1</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Connections waiting</name>
<type>DEPENDENT</type>
<key>nginx.connections.waiting</key>
<delay>0</delay>
<history>7d</history>
<description>The current number of idle client connections waiting for a request.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)
\3</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Connections writing</name>
<type>DEPENDENT</type>
<key>nginx.connections.writing</key>
<delay>0</delay>
<history>7d</history>
<description>The current number of connections where nginx is writing the response back to the client.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)
\2</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Get stub status page</name>
<type>HTTP_AGENT</type>
<key>nginx.get_stub_status</key>
<history>1h</history>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>The following status information is provided:
Active connections - the current number of active client connections including Waiting connections.
Accepts - the total number of accepted client connections.
Handled - the total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached (for example, the worker_connections limit).
Requests - the total number of client requests.
Reading - the current number of connections where nginx is reading the request header.
Writing - the current number of connections where nginx is writing the response back to the client.
Waiting - the current number of idle client connections waiting for a request.
https://nginx.org/en/docs/http/ngx_http_stub_status_module.html</description>
<applications>
<application>
<name>Zabbix raw items</name>
</application>
</applications>
<url>{$NGINX.STUB_STATUS.SCHEME}://{HOST.CONN}:{$NGINX.STUB_STATUS.PORT}/{$NGINX.STUB_STATUS.PATH}</url>
<retrieve_mode>BOTH</retrieve_mode>
<triggers>
<trigger>
<expression>{str("HTTP/1.1 200")}=0 or
{nodata(30m)}=1</expression>
<name>Nginx: Failed to fetch stub status page (or no data for 30m)</name>
<priority>WARNING</priority>
<description>Zabbix has not received data for items for the last 30 minutes.</description>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>Nginx: Service is down</name>
<expression>{Template App Nginx by HTTP:net.tcp.service[http,"{HOST.CONN}","{$NGINX.STUB_STATUS.PORT}"].last()}=0</expression>
</dependency>
</dependencies>
</trigger>
</triggers>
</item>
<item>
<name>Nginx: Requests total</name>
<type>DEPENDENT</type>
<key>nginx.requests.total</key>
<delay>0</delay>
<history>7d</history>
<description>The total number of client requests.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
\3</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Requests per second</name>
<type>DEPENDENT</type>
<key>nginx.requests.total.rate</key>
<delay>0</delay>
<history>7d</history>
<value_type>FLOAT</value_type>
<description>The total number of client requests.</description>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
\3</params>
</step>
<step>
<type>CHANGE_PER_SECOND</type>
<params/>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
</item>
<item>
<name>Nginx: Version</name>
<type>DEPENDENT</type>
<key>nginx.version</key>
<delay>0</delay>
<history>7d</history>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>Nginx</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>Server: nginx\/(.+(?<!\r))
\1</params>
</step>
<step>
<type>DISCARD_UNCHANGED_HEARTBEAT</type>
<params>1d</params>
</step>
</preprocessing>
<master_item>
<key>nginx.get_stub_status</key>
</master_item>
<triggers>
<trigger>
<expression>{diff()}=1 and {strlen()}>0</expression>
<name>Nginx: Version has changed (new version: {ITEM.VALUE})</name>
<priority>INFO</priority>
<description>Nginx version has changed. Ack to close.</description>
<manual_close>YES</manual_close>
</trigger>
</triggers>
</item>
</items>
<macros>
<macro>
<macro>{$NGINX.DROP_RATE.MAX.WARN}</macro>
<value>1</value>
<description>The critical rate of the dropped connections for trigger expression.</description>
</macro>
<macro>
<macro>{$NGINX.RESPONSE_TIME.MAX.WARN}</macro>
<value>10</value>
<description>The Nginx maximum response time in seconds for trigger expression.</description>
</macro>
<macro>
<macro>{$NGINX.STUB_STATUS.PATH}</macro>
<value>basic_status</value>
<description>The path of Nginx stub_status page.</description>
</macro>
<macro>
<macro>{$NGINX.STUB_STATUS.PORT}</macro>
<value>80</value>
<description>The port of Nginx stub_status host or container.</description>
</macro>
<macro>
<macro>{$NGINX.STUB_STATUS.SCHEME}</macro>
<value>http</value>
<description>The protocol http or https of Nginx stub_status host or container.</description>
</macro>
</macros>
<screens>
<screen>
<name>Nginx performance</name>
<hsize>2</hsize>
<vsize>2</vsize>
<screen_items>
<screen_item>
<resourcetype>0</resourcetype>
<style>0</style>
<resource>
<name>Nginx: Connections by state</name>
<host>Template App Nginx by HTTP</host>
</resource>
<width>500</width>
<height>100</height>
<x>0</x>
<y>0</y>
<colspan>1</colspan>
<rowspan>1</rowspan>
<elements>25</elements>
<valign>0</valign>
<halign>0</halign>
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<url/>
<application/>
<max_columns>3</max_columns>
</screen_item>
<screen_item>
<resourcetype>0</resourcetype>
<style>0</style>
<resource>
<name>Nginx: Requests per second</name>
<host>Template App Nginx by HTTP</host>
</resource>
<width>500</width>
<height>100</height>
<x>1</x>
<y>0</y>
<colspan>1</colspan>
<rowspan>1</rowspan>
<elements>25</elements>
<valign>0</valign>
<halign>0</halign>
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<url/>
<application/>
<max_columns>3</max_columns>
</screen_item>
<screen_item>
<resourcetype>0</resourcetype>
<style>0</style>
<resource>
<name>Nginx: Connections per second</name>
<host>Template App Nginx by HTTP</host>
</resource>
<width>500</width>
<height>100</height>
<x>0</x>
<y>1</y>
<colspan>1</colspan>
<rowspan>1</rowspan>
<elements>25</elements>
<valign>0</valign>
<halign>0</halign>
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<url/>
<application/>
<max_columns>3</max_columns>
</screen_item>
</screen_items>
</screen>
</screens>
</template>
</templates>
<graphs>
<graph>
<name>Nginx: Connections by state</name>
<graph_items>
<graph_item>
<drawtype>BOLD_LINE</drawtype>
<color>1A7C11</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.active</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<color>2774A4</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.waiting</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<color>F63100</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.writing</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<color>A54F10</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.reading</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Nginx: Connections per second</name>
<graph_items>
<graph_item>
<color>1A7C11</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.accepted.rate</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<color>2774A4</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.handled.rate</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<color>F63100</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.connections.dropped.rate</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Nginx: Requests per second</name>
<graph_items>
<graph_item>
<drawtype>GRADIENT_LINE</drawtype>
<color>1A7C11</color>
<item>
<host>Template App Nginx by HTTP</host>
<key>nginx.requests.total.rate</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
<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>