1366 lines
51 KiB
YAML
1366 lines
51 KiB
YAML
zabbix_export:
|
|
version: '7.0'
|
|
template_groups:
|
|
- uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
|
|
name: Templates/Applications
|
|
templates:
|
|
- uuid: 27f6424905884dbb96ab9210d987a56c
|
|
template: Nginx by Zabbix agent
|
|
name: Nginx by Zabbix agent (Gold)
|
|
description: 'Get metrics from stub status module using Zabbix agent running on
|
|
Linux
|
|
|
|
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
|
|
|
|
|
|
Generated by official Zabbix template tool "Templator"
|
|
|
|
'
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-1
|
|
groups:
|
|
- name: Templates/Applications
|
|
items:
|
|
- uuid: 75a7795df3034835bcfd143f7c3e9b94
|
|
name: Service response time
|
|
key: net.tcp.service.perf[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"]
|
|
value_type: FLOAT
|
|
units: s
|
|
tags:
|
|
- tag: component
|
|
value: application
|
|
- tag: component
|
|
value: health
|
|
- uuid: f06e76888f464e13b7cc4c3db33e8131
|
|
name: Service status
|
|
key: net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"]
|
|
valuemap:
|
|
name: Service state
|
|
preprocessing:
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
tags:
|
|
- tag: component
|
|
value: application
|
|
- tag: component
|
|
value: health
|
|
- uuid: 9e2be446ac79491c8be1bcd789392066
|
|
name: Connections accepted per second
|
|
type: DEPENDENT
|
|
key: nginx.connections.accepted.rate
|
|
delay: '0'
|
|
value_type: FLOAT
|
|
description: The total number of accepted client connections.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
|
|
- \1
|
|
- type: CHANGE_PER_SECOND
|
|
parameters:
|
|
- ''
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: 436f2dc87cda418eb8f19ed6910c7bd0
|
|
name: Connections active
|
|
type: DEPENDENT
|
|
key: nginx.connections.active
|
|
delay: '0'
|
|
description: The current number of active client connections including waiting
|
|
connections.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- 'Active connections: ([0-9]+)'
|
|
- \1
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: 4027e6db5e024aff98056faa2d4b43cd
|
|
name: Connections dropped per second
|
|
type: DEPENDENT
|
|
key: nginx.connections.dropped.rate
|
|
delay: '0'
|
|
value_type: FLOAT
|
|
description: The total number of dropped client connections.
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "var a = value.match(/server accepts handled requests\\s+([0-9]+) ([0-9]+)\
|
|
\ ([0-9]+)/)\nif (a) {\n\treturn a[1]-a[2]\n}\n"
|
|
- type: CHANGE_PER_SECOND
|
|
parameters:
|
|
- ''
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: 06191636a7104e1bb40d197493b80958
|
|
name: Connections handled per second
|
|
type: DEPENDENT
|
|
key: nginx.connections.handled.rate
|
|
delay: '0'
|
|
value_type: FLOAT
|
|
description: The total number of handled connections. Generally, the parameter
|
|
value is the same as for the accepted connections, unless some resource limits
|
|
have been reached (for example, the `worker_connections limit`).
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
|
|
- \2
|
|
- type: CHANGE_PER_SECOND
|
|
parameters:
|
|
- ''
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: f5925c78389143c7924432483a5c716c
|
|
name: Connections reading
|
|
type: DEPENDENT
|
|
key: nginx.connections.reading
|
|
delay: '0'
|
|
description: The current number of connections where Nginx is reading the request
|
|
header.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
|
|
- \1
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: d6cfa828ba344ffe948d8d985b849316
|
|
name: Connections waiting
|
|
type: DEPENDENT
|
|
key: nginx.connections.waiting
|
|
delay: '0'
|
|
description: The current number of idle client connections waiting for a request.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
|
|
- \3
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: c038a572f73f4a418ddcc5aeb8b0a547
|
|
name: Connections writing
|
|
type: DEPENDENT
|
|
key: nginx.connections.writing
|
|
delay: '0'
|
|
description: The current number of connections where Nginx is writing a response
|
|
back to the client.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- 'Reading: ([0-9]+) Writing: ([0-9]+) Waiting: ([0-9]+)'
|
|
- \2
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- uuid: b28444fb9b834d03a72036882c80b921
|
|
name: Requests total
|
|
type: DEPENDENT
|
|
key: nginx.requests.total
|
|
delay: '0'
|
|
description: The total number of client requests.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
|
|
- \3
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: requests
|
|
- uuid: 2600a696278f490f86cadd8c8836f269
|
|
name: Requests per second
|
|
type: DEPENDENT
|
|
key: nginx.requests.total.rate
|
|
delay: '0'
|
|
value_type: FLOAT
|
|
description: The total number of client requests.
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- server accepts handled requests\s+([0-9]+) ([0-9]+) ([0-9]+)
|
|
- \3
|
|
- type: CHANGE_PER_SECOND
|
|
parameters:
|
|
- ''
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: requests
|
|
- uuid: 3dcc81006977478f92be6dd040d66eb5
|
|
name: Version
|
|
type: DEPENDENT
|
|
key: nginx.version
|
|
delay: '0'
|
|
value_type: CHAR
|
|
trends: '0'
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- '(?i)Server: nginx\/(.+(?<!\r))'
|
|
- \1
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1d
|
|
master_item:
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
tags:
|
|
- tag: component
|
|
value: application
|
|
triggers:
|
|
- uuid: 7ad80c508f2f48b59f7659c673db9f36
|
|
expression: last(/Nginx by Zabbix agent/nginx.version,#1)<>last(/Nginx by
|
|
Zabbix agent/nginx.version,#2) and length(last(/Nginx by Zabbix agent/nginx.version))>0
|
|
name: 'Nginx: Version has changed'
|
|
event_name: 'Nginx: Version has changed (new version: {ITEM.VALUE})'
|
|
priority: INFO
|
|
description: The Nginx version has changed. Acknowledge to close the problem
|
|
manually.
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: d43b4b99b6084076a4feb1fde51ecc40
|
|
name: Get processes summary
|
|
key: proc.get[{$NGINX.PROCESS.NAME.PARAMETER},,,summary]
|
|
history: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: The aggregated data of summary metrics for all processes.
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 52a23a9f6d60490c8f5565b938154f61
|
|
name: Get stub status page
|
|
key: web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"]
|
|
history: 1h
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: 'The following status information is provided:
|
|
|
|
`Active connections` - the current number of active client connections including
|
|
waiting connections.
|
|
|
|
`Accepted` - the total number of accepted client connections.
|
|
|
|
`Handled` - the total number of handled connections. Generally, the parameter
|
|
value is the same as for the accepted connections, 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 a response
|
|
back to the client.
|
|
|
|
`Waiting` - the current number of idle client connections waiting for a request.
|
|
|
|
|
|
See also [Module ngx_http_stub_status_module](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html).
|
|
|
|
'
|
|
tags:
|
|
- tag: component
|
|
value: application
|
|
- tag: component
|
|
value: health
|
|
discovery_rules:
|
|
- uuid: f4a898f929c54b3493506e68703fa2cc
|
|
name: Nginx process discovery
|
|
type: DEPENDENT
|
|
key: nginx.proc.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#NGINX.NAME}'
|
|
value: '{$NGINX.PROCESS_NAME}'
|
|
formulaid: A
|
|
description: The discovery of Nginx process summary.
|
|
item_prototypes:
|
|
- uuid: 632e441011674f04886096475180dcbb
|
|
name: Get process data
|
|
type: DEPENDENT
|
|
key: nginx.proc.get[{#NGINX.NAME}]
|
|
delay: '0'
|
|
history: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: The summary metrics aggregated by a process {#NGINX.NAME}.
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.[?(@["name"]=="{#NGINX.NAME}")].first()
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: Failed to retrieve process {#NGINX.NAME} data
|
|
master_item:
|
|
key: proc.get[{$NGINX.PROCESS.NAME.PARAMETER},,,summary]
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: ba3da6baccee4b31947bf20d3cae0e5f
|
|
name: Number of running processes
|
|
type: DEPENDENT
|
|
key: nginx.proc.num[{#NGINX.NAME}]
|
|
delay: '0'
|
|
description: The number of running processes {#NGINX.NAME}.
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.processes
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '0'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: nginx.proc.get[{#NGINX.NAME}]
|
|
tags:
|
|
- tag: component
|
|
value: system
|
|
trigger_prototypes:
|
|
- uuid: 903e6a1f30154ee49df3f8d87e0164cc
|
|
expression: last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])=0
|
|
name: 'Nginx: Process is not running'
|
|
priority: HIGH
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 5887d0062bed4233a03d4f408fac7163
|
|
name: Memory usage, %
|
|
type: DEPENDENT
|
|
key: nginx.proc.pmem[{#NGINX.NAME}]
|
|
delay: '0'
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: The percentage of real memory used by a process {#NGINX.NAME}.
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pmem
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: nginx.proc.get[{#NGINX.NAME}]
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 64d208475c034bae953a64cde1833ebb
|
|
name: Memory usage (rss)
|
|
type: DEPENDENT
|
|
key: nginx.proc.rss[{#NGINX.NAME}]
|
|
delay: '0'
|
|
units: B
|
|
description: The summary of resident set size memory used by a process {#NGINX.NAME}
|
|
expressed in bytes.
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.rss
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: nginx.proc.get[{#NGINX.NAME}]
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 21fccb0286fb407c85f1972e994c698e
|
|
name: Memory usage (vsize)
|
|
type: DEPENDENT
|
|
key: nginx.proc.vmem[{#NGINX.NAME}]
|
|
delay: '0'
|
|
units: B
|
|
description: The summary of virtual memory used by a process {#NGINX.NAME}
|
|
expressed in bytes.
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.vsize
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: nginx.proc.get[{#NGINX.NAME}]
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 84c95c1955bf4ccaa12a060a9acdb478
|
|
name: CPU utilization
|
|
key: proc.cpu.util[{#NGINX.NAME}]
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: The percentage of the CPU utilization by a process {#NGINX.NAME}.
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
trigger_prototypes:
|
|
- uuid: a497b80eb03f469c9552881b498003b2
|
|
expression: '(find(/Nginx by Zabbix agent/web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"],,"iregexp","HTTP\\/[\\d.]+\\s+200")=0
|
|
or
|
|
|
|
nodata(/Nginx by Zabbix agent/web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"],30m))
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
|
|
'
|
|
name: 'Nginx: Failed to fetch stub status page'
|
|
event_name: 'Nginx: Failed to fetch stub status page (or no data for 30m)'
|
|
priority: WARNING
|
|
description: Zabbix has not received any data for items for the last 30 minutes.
|
|
manual_close: 'YES'
|
|
dependencies:
|
|
- name: 'Nginx: Service is down'
|
|
expression: last(/Nginx by Zabbix agent/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: f2d431fa9bc446608caa3f80ef27c41b
|
|
expression: min(/Nginx by Zabbix agent/nginx.connections.dropped.rate,5m)
|
|
> {$NGINX.DROP_RATE.MAX.WARN} and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
name: 'Nginx: High connections drop rate'
|
|
event_name: 'Nginx: High connections drop rate (more than {$NGINX.DROP_RATE.MAX.WARN}
|
|
for 5m)'
|
|
opdata: 'Current rate: {ITEM.LASTVALUE1}'
|
|
priority: WARNING
|
|
description: The rate of dropping connections has been greater than {$NGINX.DROP_RATE.MAX.WARN}
|
|
for the last 5 minutes.
|
|
dependencies:
|
|
- name: 'Nginx: Service is down'
|
|
expression: last(/Nginx by Zabbix agent/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: c043191c22f34522ba4f83430d9f88b1
|
|
expression: last(/Nginx by Zabbix agent/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
name: 'Nginx: Service is down'
|
|
priority: AVERAGE
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: f5db329410a14609a5f3e883ca493cc8
|
|
expression: min(/Nginx by Zabbix agent/net.tcp.service.perf[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"],5m)>{$NGINX.RESPONSE_TIME.MAX.WARN}
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
name: 'Nginx: Service response time is too high'
|
|
event_name: 'Nginx: Service response time is too high (over {$NGINX.RESPONSE_TIME.MAX.WARN}s
|
|
for 5m)'
|
|
priority: WARNING
|
|
manual_close: 'YES'
|
|
dependencies:
|
|
- name: 'Nginx: Service is down'
|
|
expression: last(/Nginx by Zabbix agent/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0
|
|
and last(/Nginx by Zabbix agent/nginx.proc.num[{#NGINX.NAME}])>0
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
graph_prototypes:
|
|
- uuid: 69ca908afa1d468d983a263d06910925
|
|
name: 'Nginx: Memory usage[{#NGINX.NAME}]'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.proc.vmem[{#NGINX.NAME}]
|
|
- sortorder: '1'
|
|
drawtype: BOLD_LINE
|
|
color: F63100
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.proc.rss[{#NGINX.NAME}]
|
|
master_item:
|
|
key: proc.get[{$NGINX.PROCESS.NAME.PARAMETER},,,summary]
|
|
lld_macro_paths:
|
|
- lld_macro: '{#NGINX.NAME}'
|
|
path: $.name
|
|
- name: 'Insight: Log de Acesso'
|
|
type: ZABBIX_ACTIVE
|
|
key: nginx.access.logs.list
|
|
delay: 1s
|
|
enabled_lifetime_type: DISABLE_AFTER
|
|
enabled_lifetime: 1h
|
|
item_prototypes:
|
|
- name: 'Insight: Acesso {#HOST_SITE}'
|
|
type: ZABBIX_ACTIVE
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
delay: 1s
|
|
history: 91d
|
|
value_type: LOG
|
|
timeout: 120s
|
|
tags:
|
|
- tag: Insight
|
|
value: access log
|
|
- name: 'Insight: Bad-Bot {#HOST_SITE}'
|
|
type: ZABBIX_ACTIVE
|
|
key: log[/var/log/nginx/{#HOST_SITE}.bad-bot.log]
|
|
delay: 1s
|
|
value_type: LOG
|
|
timeout: 120s
|
|
tags:
|
|
- tag: Insight
|
|
value: bad-bot
|
|
- name: 'Insight: Erros {#HOST_SITE}'
|
|
type: ZABBIX_ACTIVE
|
|
key: log[/var/log/nginx/{#HOST_SITE}.error.log]
|
|
delay: 1s
|
|
value_type: LOG
|
|
timeout: 120s
|
|
tags:
|
|
- tag: Insight
|
|
value: error log
|
|
- name: 'Nginx: Cache HITs Flag for {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.cache.hit.flag.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- upstream_cache_status":"HIT"
|
|
- '1'
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '0'
|
|
master_item:
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
tags:
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache Hit Ratio (Ultimo 1m) (%) {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.hit.ratio.1m.[{#HOST_SITE}]
|
|
value_type: FLOAT
|
|
units: '%'
|
|
params: (last(//nginx.cache.hits.1m.[{#HOST_SITE}]) * 100) / (last(//nginx.cache.hits.1m.[{#HOST_SITE}])
|
|
+ last(//nginx.cache.miss.1m.[{#HOST_SITE}]) + (last(//nginx.cache.hits.1m.[{#HOST_SITE}])
|
|
+ last(//nginx.cache.miss.1m.[{#HOST_SITE}]) = 0))
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Cache HITs no Ultimo minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.hits.1m.[{#HOST_SITE}]
|
|
units: hits
|
|
params: sum(//nginx.cache.hit.flag.[{#HOST_SITE}],1m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache HITs nos Ultimos 5 minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.hits.5m.[{#HOST_SITE}]
|
|
delay: 4m
|
|
units: hits
|
|
params: sum(//nginx.cache.hit.flag.[{#HOST_SITE}],5m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache HITs nos Ultimos 15 minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.hits.15m.[{#HOST_SITE}]
|
|
delay: 14m
|
|
units: hits
|
|
params: sum(//nginx.cache.hit.flag.[{#HOST_SITE}],15m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache HITs nos Ultimos 24 hrs {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.hits.24h.[{#HOST_SITE}]
|
|
delay: 1h
|
|
units: hits
|
|
params: sum(//nginx.cache.hit.flag.[{#HOST_SITE}],24h)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache MISS no Ultimo minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.miss.1m.[{#HOST_SITE}]
|
|
units: miss
|
|
params: sum(//nginx.cache.miss.flag.[{#HOST_SITE}],1m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache MISS no Ultimos 5 minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.miss.5m.[{#HOST_SITE}]
|
|
delay: 4m
|
|
units: miss
|
|
params: sum(//nginx.cache.miss.flag.[{#HOST_SITE}],5m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache MISS no Ultimos 15 minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.miss.15m.[{#HOST_SITE}]
|
|
delay: 14m
|
|
units: miss
|
|
params: sum(//nginx.cache.miss.flag.[{#HOST_SITE}],15m)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache MISS no Ultimos 24 horas {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.miss.24h.[{#HOST_SITE}]
|
|
delay: 1h
|
|
units: miss
|
|
params: sum(//nginx.cache.miss.flag.[{#HOST_SITE}],24h)
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: Cache MISS Flag for {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.cache.miss.flag.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: REGEX
|
|
parameters:
|
|
- upstream_cache_status":"MISS"
|
|
- '1'
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Cache Miss Ratio (Ultimo 1m) (%) {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.cache.miss.ratio.1m.[{#HOST_SITE}]
|
|
value_type: FLOAT
|
|
units: '%'
|
|
params: (last(//nginx.cache.miss.1m.[{#HOST_SITE}]) * 100) / (last(//nginx.cache.hits.1m.[{#HOST_SITE}])
|
|
+ last(//nginx.cache.miss.1m.[{#HOST_SITE}]) + (last(//nginx.cache.hits.1m.[{#HOST_SITE}])
|
|
+ last(//nginx.cache.miss.1m.[{#HOST_SITE}]) = 0))
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: {#HOST_SITE} Marcações Usuario Online'
|
|
type: DEPENDENT
|
|
key: nginx.log.user_status.list[{#HOST_SITE}}]
|
|
value_type: TEXT
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "// Versão compatível com JavaScript antigo (ES5) - Saída em Texto Puro\n\
|
|
\ // Usamos um objeto para garantir que cada usuário seja único.\n\
|
|
\ var uniqueUsers = {};\n\n var remoteUserRegex = /\"remote_user\"\
|
|
:\"([a-zA-Z0-9._-]+)\"/g;\n var cookieUserRegex = /nc_username=([a-zA-Z0-9._-]+);/g;\n\
|
|
\ var urlUserRegex = /\\/remote\\.php\\/dav\\/files\\/([a-zA-Z0-9._-]+)\\\
|
|
//g;\n\n var lines = value.split('\\n');\n\n for (var i = 0; i <\
|
|
\ lines.length; i++) {\n var line = lines[i];\n var match;\n\
|
|
\n // Função auxiliar para adicionar usuários ao nosso objeto de\
|
|
\ unicidade\n function findAndAdd(regex) {\n while ((match\
|
|
\ = regex.exec(line)) !== null) {\n if (match[1] && match[1].length\
|
|
\ > 0) {\n // Adiciona o usuário completo como uma\
|
|
\ chave do objeto.\n uniqueUsers[match[1]] = true;\n\
|
|
\ }\n }\n }\n \n findAndAdd(remoteUserRegex);\n\
|
|
\ findAndAdd(cookieUserRegex);\n findAndAdd(urlUserRegex);\n\
|
|
\ }\n\n // Pega todas as chaves do objeto para formar o array final\
|
|
\ de usuários únicos.\n var userArray = Object.keys(uniqueUsers);\n\
|
|
\n // --- LINHA ALTERADA ---\n // Une todos os elementos do array\
|
|
\ em uma única string,\n // separando cada um com um caractere de quebra\
|
|
\ de linha ('\\n').\n return userArray.join('\\n');\n"
|
|
master_item:
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
tags:
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: Requests Excelentes por minuto {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.requests.excellent.count.1m.[{#HOST_SITE}]
|
|
units: reqs/min
|
|
params: "last(//nginx.request_time.count.0-20ms.1m.[{#HOST_SITE}]) + \nlast(//nginx.request_time.count.21-50ms.1m.[{#HOST_SITE}])\
|
|
\ + \nlast(//nginx.request_time.count.51-100ms.1m.[{#HOST_SITE}]) + \nlast(//nginx.request_time.count.101-200ms.1m.[{#HOST_SITE}])\n"
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Requisição nos Ultimos 5 Minuto em {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.requests.per_5minute[{#HOST_SITE}]
|
|
delay: 4m
|
|
units: requests
|
|
params: count(//log[/var/log/nginx/{#HOST_SITE}.access.log],5m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Requisição nos Ultimos 15 Minuto em {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.requests.per_15minute[{#HOST_SITE}]
|
|
delay: 14m
|
|
units: requests
|
|
params: count(//log[/var/log/nginx/{#HOST_SITE}.access.log],15m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Requisição nos Ultimos 24 horas em {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.requests.per_24h[{#HOST_SITE}]
|
|
delay: 1h
|
|
units: requests
|
|
params: count(//log[/var/log/nginx/{#HOST_SITE}.access.log],24h)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Requisição no Ultimo 1 Minuto em {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.requests.per_minute[{#HOST_SITE}]
|
|
units: requests
|
|
params: count(//log[/var/log/nginx/{#HOST_SITE}.access.log],1m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Média de Tempo de Resposta (1m) {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.request_time.avg.1m.[{#HOST_SITE}]
|
|
value_type: FLOAT
|
|
units: ms
|
|
params: avg(//nginx.request_time.[{#HOST_SITE}],1m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Média de Tempo de Resposta (5m) {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.request_time.avg.5m.[{#HOST_SITE}]
|
|
delay: 4m
|
|
value_type: FLOAT
|
|
units: ms
|
|
params: avg(//nginx.request_time.[{#HOST_SITE}],5m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Insight: Média de Tempo de Resposta (15m) {#HOST_SITE}'
|
|
type: CALCULATED
|
|
key: nginx.request_time.avg.15m.[{#HOST_SITE}]
|
|
value_type: FLOAT
|
|
units: ms
|
|
params: avg(//nginx.request_time.[{#HOST_SITE}],15m)
|
|
tags:
|
|
- tag: Insight
|
|
value: carga
|
|
- name: 'Nginx: RTime Flag (0-20ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.0-20ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 0 && value_ms <= 20) {\n return 1;\n }\n\n // Se não\
|
|
\ estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (21-50ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.21-50ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 21 && value_ms <= 50) {\n return 1;\n }\n\n // Se não\
|
|
\ estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (51-100ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.51-100ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 51 && value_ms <= 100) {\n return 1;\n }\n\n // Se não\
|
|
\ estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (201-300ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.201-300ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 201 && value_ms <= 300) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (301-400ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.301-400ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 301 && value_ms <= 400) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (401-500ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.401-500ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 401 && value_ms <= 500) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (501-600ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.501-600ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 501 && value_ms <= 600) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (601-700ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.601-700ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 601 && value_ms <= 700) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (701-800ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.701-800ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 701 && value_ms <= 800) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (801-900ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.801-900ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 801 && value_ms <= 900) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (1001-2000ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.1001-2000ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 1001 && value_ms <= 2000) {\n return 1;\n }\n\n // Se\
|
|
\ não estiver na faixa, retorna null para o Zabbix descartar.\n return\
|
|
\ 0;\n} catch (e) {\n // Se der qualquer erro, também descarta.\n \
|
|
\ return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Nginx: RTime Flag (>3001ms) {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.flag.3001ms.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // O valor chega em segundos (ex: 0.015), convertemos para\
|
|
\ milissegundos.\n var value_ms = parseFloat(value) * 1000;\n\n \
|
|
\ // Verifica se o valor está na faixa de 0 a 20ms.\n if (value_ms\
|
|
\ >= 3001) {\n return 1;\n }\n\n // Se não estiver na faixa,\
|
|
\ retorna null para o Zabbix descartar.\n return 0;\n} catch (e) {\n\
|
|
\ // Se der qualquer erro, também descarta.\n return 0;\n}\n"
|
|
master_item:
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
- name: 'Insight: Tempo de Resposta Total {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
value_type: FLOAT
|
|
units: s
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n // A variável 'value' contém a linha de log completa.\n \
|
|
\ // A regex procura por \"request_time\": e captura o número que vem\
|
|
\ depois.\n var regex = /\"request_time\":(\\d+\\.?\\d*)/;\n var\
|
|
\ match = value.match(regex);\n\n // Se encontrar, match[1] conterá\
|
|
\ apenas o número (ex: \"0.282\").\n if (match && match[1]) {\n \
|
|
\ return match[1];\n }\n\n // Se não encontrar, descarta o valor.\n\
|
|
\ return null;\n} catch (e) {\n // Se houver qualquer erro, também\
|
|
\ descarta.\n return null;\n}\n"
|
|
master_item:
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
tags:
|
|
- tag: Insight
|
|
value: access log
|
|
- name: 'Nginx: URI da Requisição {#HOST_SITE}'
|
|
type: DEPENDENT
|
|
key: nginx.request_uri.[{#HOST_SITE}]
|
|
value_type: TEXT
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "try {\n var regex = /\"request_uri\":\"([^\"]+)\"/;\n var match\
|
|
\ = value.match(regex);\n if (match && match[1]) {\n return\
|
|
\ match[1];\n }\n return null;\n} catch (e) {\n return null;\n\
|
|
}\n"
|
|
master_item:
|
|
key: log[/var/log/nginx/{#HOST_SITE}.access.log]
|
|
tags:
|
|
- tag: Insight
|
|
value: cache
|
|
- tag: Insight
|
|
value: performance
|
|
graph_prototypes:
|
|
- name: 'Insight: Cache HITS {#HOST_SITE}'
|
|
yaxismax: '0'
|
|
percent_right: '20'
|
|
ymin_type_1: FIXED
|
|
graph_items:
|
|
- color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hits.5m.[{#HOST_SITE}]
|
|
- sortorder: '1'
|
|
color: F63100
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hits.15m.[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
color: 2774A4
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hits.24h.[{#HOST_SITE}]
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hits.1m.[{#HOST_SITE}]
|
|
- name: 'Insight: Cache HIT vs MISS {#HOST_SITE}'
|
|
show_work_period: 'NO'
|
|
show_triggers: 'NO'
|
|
type: PIE
|
|
graph_items:
|
|
- color: F63100
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.miss.ratio.1m.[{#HOST_SITE}]
|
|
- sortorder: '1'
|
|
color: 199C0D
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hit.ratio.1m.[{#HOST_SITE}]
|
|
- name: 'Insight: Cache MISS {#HOST_SITE}'
|
|
yaxismax: '0'
|
|
percent_right: '20'
|
|
ymin_type_1: FIXED
|
|
graph_items:
|
|
- color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.miss.1m.[{#HOST_SITE}]
|
|
- sortorder: '1'
|
|
color: F63100
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.miss.5m.[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
color: 2774A4
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.miss.15m.[{#HOST_SITE}]
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.miss.24h.[{#HOST_SITE}]
|
|
- name: 'Insight: Requisições {#HOST_SITE}'
|
|
yaxismax: '0'
|
|
ymin_type_1: FIXED
|
|
graph_items:
|
|
- color: F63100
|
|
yaxisside: RIGHT
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.requests.per_minute[{#HOST_SITE}]
|
|
- sortorder: '1'
|
|
color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.requests.per_5minute[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
color: 2774A4
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.requests.per_15minute[{#HOST_SITE}]
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.requests.per_24h[{#HOST_SITE}]
|
|
- name: 'Insight: Saúde do Site {#HOST_SITE}'
|
|
show_work_period: 'NO'
|
|
graph_items:
|
|
- color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"]
|
|
- sortorder: '1'
|
|
color: F63100
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.cache.hit.ratio.1m.[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
color: F7941D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.request_time.avg.1m.[{#HOST_SITE}]
|
|
- name: 'Insight: Tempo de Resposta vs Requisições {#HOST_SITE}'
|
|
ymin_type_1: FIXED
|
|
graph_items:
|
|
- sortorder: '1'
|
|
color: F63100
|
|
yaxisside: RIGHT
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.requests.per_minute[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
drawtype: FILLED_REGION
|
|
color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.request_time.[{#HOST_SITE}]
|
|
- name: 'Insight: Tempos de Resposta {#HOST_SITE}'
|
|
percent_right: '20'
|
|
ymin_type_1: FIXED
|
|
graph_items:
|
|
- color: 199C0D
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.request_time.avg.1m.[{#HOST_SITE}]
|
|
- sortorder: '1'
|
|
color: F63100
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.request_time.avg.5m.[{#HOST_SITE}]
|
|
- sortorder: '2'
|
|
color: 2774A4
|
|
calc_fnc: ALL
|
|
item:
|
|
host: srvproxy001
|
|
key: nginx.request_time.avg.15m.[{#HOST_SITE}]
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- "// A variável 'value' é a string completa do UserParameter, contendo caminhos\n\
|
|
// separados por vírgula, espaço e/ou quebra de linha.\n // A Regex /[\\\
|
|
s,]+/ divide a string em:\n // - Vírgulas (,)\n // - Espaços (incluindo\
|
|
\ múltiplos)\n // - Quebras de linha (\\n, \\r)\n // O filter(Boolean)\
|
|
\ remove quaisquer entradas vazias que o split possa gerar.\n var full_paths\
|
|
\ = value.trim().split(/[\\s,]+/).filter(Boolean);\n \n var lld_data\
|
|
\ = [];\n \n // Regex para extrair o nome do site:\n // ^ -> Início\
|
|
\ do item (após o split)\n // (.+) -> Captura o nome do site (o que for\
|
|
\ que esteja lá)\n var regex = /^\\/var\\/log\\/nginx\\/(.+)\\.access\\\
|
|
.log$/;\n \n // Itera sobre todos os caminhos.\n for (var i = 0;\
|
|
\ i < full_paths.length; i++) {\n var path = full_paths[i];\n \
|
|
\ \n // Aplica a regex em cada item.\n var match = path.match(regex);\n\
|
|
\ \n // match[1] contém o nome do site capturado em (.+).\n\
|
|
\ if (match && match[1]) { \n lld_data.push({\n \
|
|
\ \"{#HOST_SITE}\": match[1]\n });\n }\n }\n\
|
|
\ \n // Retorna o JSON LLD final.\n return JSON.stringify({ \"\
|
|
data\": lld_data });\n"
|
|
tags:
|
|
- tag: class
|
|
value: software
|
|
- tag: target
|
|
value: nginx
|
|
macros:
|
|
- macro: '{$NGINX.DROP_RATE.MAX.WARN}'
|
|
value: '1'
|
|
description: The critical rate of the dropped connections for a trigger expression.
|
|
- macro: '{$NGINX.PROCESS.NAME.PARAMETER}'
|
|
description: The process name of the Nginx server used in the item key `proc.get`.
|
|
It could be specified if the correct process name is known.
|
|
- macro: '{$NGINX.PROCESS_NAME}'
|
|
value: nginx
|
|
description: The process name filter for the Nginx process discovery.
|
|
- macro: '{$NGINX.RESPONSE_TIME.MAX.WARN}'
|
|
value: '10'
|
|
description: The maximum response time of Nginx expressed in seconds for a trigger
|
|
expression.
|
|
- macro: '{$NGINX.STUB_STATUS.HOST}'
|
|
value: localhost
|
|
description: The hostname or IP address of the Nginx host or Nginx container
|
|
of `astub_status`.
|
|
- macro: '{$NGINX.STUB_STATUS.PATH}'
|
|
value: basic_status
|
|
description: The path of the `Nginx stub_status` page.
|
|
- macro: '{$NGINX.STUB_STATUS.PORT}'
|
|
value: '80'
|
|
description: The port of the `Nginx stub_status` host or container.
|
|
dashboards:
|
|
- uuid: 9d071e3a148c405e85c53ef25d54efaf
|
|
name: Nginx performance
|
|
pages:
|
|
- widgets:
|
|
- type: graph
|
|
width: '36'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid.0
|
|
value:
|
|
host: Nginx by Zabbix agent
|
|
name: 'Nginx: Connections by state'
|
|
- type: STRING
|
|
name: reference
|
|
value: AAAAA
|
|
- type: graph
|
|
y: '5'
|
|
width: '36'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid.0
|
|
value:
|
|
host: Nginx by Zabbix agent
|
|
name: 'Nginx: Connections per second'
|
|
- type: STRING
|
|
name: reference
|
|
value: AAAAC
|
|
- type: graph
|
|
x: '36'
|
|
width: '36'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid.0
|
|
value:
|
|
host: Nginx by Zabbix agent
|
|
name: 'Nginx: Requests per second'
|
|
- type: STRING
|
|
name: reference
|
|
value: AAAAB
|
|
valuemaps:
|
|
- uuid: 53c8528c18814f30a45d1540ab9e5c00
|
|
name: Service state
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Down
|
|
- value: '1'
|
|
newvalue: Up
|
|
graphs:
|
|
- uuid: ba234158aeca468a8592d944f9aae691
|
|
name: 'Nginx: Connections by state'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.active
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.waiting
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.writing
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.reading
|
|
- uuid: b82a5b89864a47638421458f3e74563d
|
|
name: 'Nginx: Connections per second'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.accepted.rate
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.handled.rate
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.connections.dropped.rate
|
|
- uuid: a2d2fec823514df09731381304c245e9
|
|
name: 'Nginx: Requests per second'
|
|
graph_items:
|
|
- drawtype: GRADIENT_LINE
|
|
color: 199C0D
|
|
item:
|
|
host: Nginx by Zabbix agent
|
|
key: nginx.requests.total.rate
|