zabbix_export: version: '7.0' template_groups: - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6 name: Templates/Applications templates: - uuid: d2cebb67b4d94a12a072db85e7be6a33 template: 'Nginx by Zabbix agent active' name: 'Nginx by Zabbix agent active' 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: 09762f260f544f57afa5157c6bc632a3 name: 'Service response time' type: ZABBIX_ACTIVE 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: b68e4123d7c9483c9f77bc9c27fd0e7c name: 'Service status' type: ZABBIX_ACTIVE 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: 8db87e1a5a6e478eb4e554b477abb5a4 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: cdc0f7d6ad334a219221d7c0b7bf866c 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: 7dea09085ee84f79837e6f43485f39df 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]+)/) if (a) { return a[1]-a[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: eb25d53ee75148fa890054b116fb8960 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: 22d33954da1243c8a2c015f873f7cff3 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: 92c8ccf4863d46e1848fe2c61e0a86e2 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: e5c99f0d7d714168a5ecd100aa42a63a 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: 9276808621ea44e19afd6e42ed4002ee 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: bc688f502c2940d584f22ace27342b92 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: 3667a75132654b01b1e0aff6ed059353 name: Version type: DEPENDENT key: nginx.version delay: '0' value_type: CHAR trends: '0' preprocessing: - type: REGEX parameters: - '(?i)Server: nginx\/(.+(?last(/Nginx by Zabbix agent active/nginx.version,#2) and length(last(/Nginx by Zabbix agent active/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: 94bb17445cf14e909fede8b7060c0211 name: 'Get processes summary' type: ZABBIX_ACTIVE 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: 04ed4f82a84b4a81aa8d1682e7a70b5f name: 'Get stub status page' type: ZABBIX_ACTIVE 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: b0fa23a0c13b4c11b79369d6cfadc0bb 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: 4a897c7bc31f4413b8c0d0eb050d0eac 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: f75fa5d7714941d0b25c9e8767a7a7f7 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: c95c9632cded4bf48df1c736ec7078c5 expression: 'last(/Nginx by Zabbix agent active/nginx.proc.num[{#NGINX.NAME}])=0' name: 'Nginx: Process is not running' priority: HIGH tags: - tag: scope value: availability - uuid: 73bee8a0acc84c678a0b1974dbb82964 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: e799880b7374482196780173461213af 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: d993483fab9a41f5b5a6457e09647288 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: 6045ce9aba4747f2a6a1475fc3f8b428 name: 'CPU utilization' type: ZABBIX_ACTIVE 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: 17f59999c0ee40788aa20979f396616b expression: | (find(/Nginx by Zabbix agent active/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 active/web.page.get["{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PATH}","{$NGINX.STUB_STATUS.PORT}"],30m)) and last(/Nginx by Zabbix agent active/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 active/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0 and last(/Nginx by Zabbix agent active/nginx.proc.num[{#NGINX.NAME}])>0' tags: - tag: scope value: availability - uuid: ff0d5f7f9ae740e3966af8cba9856a00 expression: 'min(/Nginx by Zabbix agent active/nginx.connections.dropped.rate,5m) > {$NGINX.DROP_RATE.MAX.WARN} and last(/Nginx by Zabbix agent active/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 active/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0 and last(/Nginx by Zabbix agent active/nginx.proc.num[{#NGINX.NAME}])>0' tags: - tag: scope value: performance - uuid: 5ed915dd28814134bcbf78738ad8173c expression: 'last(/Nginx by Zabbix agent active/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0 and last(/Nginx by Zabbix agent active/nginx.proc.num[{#NGINX.NAME}])>0' name: 'Nginx: Service is down' priority: AVERAGE manual_close: 'YES' tags: - tag: scope value: availability - uuid: bc6c56323e694cd391f6a80ebbac0c35 expression: 'min(/Nginx by Zabbix agent active/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 active/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 active/net.tcp.service[http,"{$NGINX.STUB_STATUS.HOST}","{$NGINX.STUB_STATUS.PORT}"])=0 and last(/Nginx by Zabbix agent active/nginx.proc.num[{#NGINX.NAME}])>0' tags: - tag: scope value: performance graph_prototypes: - uuid: 60d7f859559246fe902edd8a12ab4c70 name: 'Nginx: Memory usage[{#NGINX.NAME}]' graph_items: - drawtype: BOLD_LINE color: 199C0D item: host: 'Nginx by Zabbix agent active' key: 'nginx.proc.vmem[{#NGINX.NAME}]' - sortorder: '1' drawtype: BOLD_LINE color: F63100 item: host: 'Nginx by Zabbix agent active' 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 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: d066178c8aa942a5b82e7a6fdbd21880 name: 'Nginx performance' pages: - widgets: - type: graph width: '36' height: '5' fields: - type: GRAPH name: graphid.0 value: host: 'Nginx by Zabbix agent active' 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 active' 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 active' name: 'Nginx: Requests per second' - type: STRING name: reference value: AAAAB valuemaps: - uuid: 664f36475a624b6bbf6a23c430baaa9b name: 'Service state' mappings: - value: '0' newvalue: Down - value: '1' newvalue: Up graphs: - uuid: 5321b82a5beb4688b29f369acd0191c1 name: 'Nginx: Connections by state' graph_items: - drawtype: BOLD_LINE color: 199C0D item: host: 'Nginx by Zabbix agent active' key: nginx.connections.active - sortorder: '1' color: F63100 item: host: 'Nginx by Zabbix agent active' key: nginx.connections.waiting - sortorder: '2' color: 00611C item: host: 'Nginx by Zabbix agent active' key: nginx.connections.writing - sortorder: '3' color: F7941D item: host: 'Nginx by Zabbix agent active' key: nginx.connections.reading - uuid: 993c7b78c337451992a048be7ed028e4 name: 'Nginx: Connections per second' graph_items: - color: 199C0D item: host: 'Nginx by Zabbix agent active' key: nginx.connections.accepted.rate - sortorder: '1' color: F63100 item: host: 'Nginx by Zabbix agent active' key: nginx.connections.handled.rate - sortorder: '2' color: 00611C item: host: 'Nginx by Zabbix agent active' key: nginx.connections.dropped.rate - uuid: d22b45b11f2746ae8a26b54417a67424 name: 'Nginx: Requests per second' graph_items: - drawtype: GRADIENT_LINE color: 199C0D item: host: 'Nginx by Zabbix agent active' key: nginx.requests.total.rate