zabbix_export: version: '5.4' date: '2021-11-21T21:34:01Z' groups: - uuid: 7df96b18c230490a9a0a9e2307226338 name: Templates templates: - uuid: 3f1dd24248f44952ac9cd6ef446aa23e template: 'App Nginx by Alex Gluck' name: 'App Nginx by Alex Gluck' description: | ## Overview System requirements ------------------- [Nginx](http://nginx.org/ "Nginx"), with configured `http\_stub\_status\_module` Features -------- ##### HTTP/HTTPS support ##### Connection Statistics: * Active * Reading * Waiting * Writing ##### Request Statistics: * Accepted * Handled * Total ##### Graph and screen: * 'Requests Statistics' graph * 'Connection Status' graph * Screen combining both graph ##### Macros for customization: * {$NGINX\_HOST} * {$NGINX\_STATS\_URI} * {$NGINX\_PORT} * {$NGINX\_REQ\_NUM} * {$NGINX\_CON\_NUM} Installation ------------ ### Nginx Configuration Add the following example to your default vhost configuration file: ``` location /nginx\_status { stub\_status on; access\_log off; allow 127.0.0.1; allow ::1; deny all; } ``` ``` ``` ### Zabbix Configuration 1. Import XML template file (`zbx\_template\_nginx.xml`) into Zabbix via Web GUI (Configuration -> Templates -> Import). 2. Assign the imported template to a host and enjoy! ## Author Alex Gluck groups: - name: Templates items: - uuid: 547d5b54b5fa40d5b2aff11d8224f8ab name: 'Nginx: connections accepted per sec' type: DEPENDENT key: nginx.accepts delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - \s\d+\s\d+\s\d+ - \0 - type: REGEX parameters: - \d+ - \0 - type: CHANGE_PER_SECOND parameters: - '' master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx - uuid: a73900d270fa4a7c8f5d7cc50bb68a69 name: 'Nginx: connects active' type: DEPENDENT key: nginx.active.connect delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - 'Active(.*)' - \0 - type: REGEX parameters: - \d+ - \0 master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx triggers: - uuid: 925153f0c38b450d99771427eb6df55d expression: 'last(/App Nginx by Alex Gluck/nginx.active.connect)>{$NGINX_CON_NUM}' recovery_mode: RECOVERY_EXPRESSION recovery_expression: 'last(/App Nginx by Alex Gluck/nginx.active.connect)<{$NGINX_CON_NUM}*0.8' name: 'Nginx: many active connections on {HOST.NAME}' priority: WARNING manual_close: 'YES' dependencies: - name: 'Nginx: nginx is not running on {HOST.NAME}' expression: 'last(/App Nginx by Alex Gluck/proc.num[nginx])<1' - uuid: dbc5649307064f5b975733531f97a3d1 name: 'Nginx: connections handled per sec' type: DEPENDENT key: nginx.handled delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - \s\d+\s\d+\s\d+ - \0 - type: REGEX parameters: - \s\d+\s\d+\s - \0 - type: REGEX parameters: - '\s\d+\s(.*)' - \1 - type: CHANGE_PER_SECOND parameters: - '' master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx - uuid: 547af94e50724df98c94c3b7f5a91dab name: 'Nginx: connections reading' type: DEPENDENT key: nginx.reading delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - 'Reading:(.*)' - \0 - type: REGEX parameters: - \d+ - \0 master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx - uuid: c2737b17828a475db6aff738c4c6c472 name: 'Nginx: requests per sec' type: DEPENDENT key: nginx.requests delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - \s\d+\s\d+\s\d+ - \0 - type: REGEX parameters: - '\s\d+\s\d+\s(.*)' - \1 - type: CHANGE_PER_SECOND parameters: - '' master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx triggers: - uuid: ec210d0be3aa479f83df1b88894d21fc expression: 'avg(/App Nginx by Alex Gluck/nginx.requests,240s)>{$NGINX_REQ_NUM}' recovery_mode: RECOVERY_EXPRESSION recovery_expression: 'avg(/App Nginx by Alex Gluck/nginx.requests,240s)>{$NGINX_REQ_NUM}*0.8' name: 'Nginx: many requests on {HOST.NAME}' priority: WARNING manual_close: 'YES' dependencies: - name: 'Nginx: nginx is not running on {HOST.NAME}' expression: 'last(/App Nginx by Alex Gluck/proc.num[nginx])<1' - uuid: 2e403ab9c0d6460a822e532a3d917cf2 expression: 'avg(/App Nginx by Alex Gluck/nginx.requests,240s)>{$NGINX_REQ_NUM}*1.5' recovery_mode: RECOVERY_EXPRESSION recovery_expression: 'avg(/App Nginx by Alex Gluck/nginx.requests,240s)>{$NGINX_REQ_NUM}*0.8' name: 'Nginx: too many requests on {HOST.NAME}' priority: AVERAGE manual_close: 'YES' dependencies: - name: 'Nginx: many active connections on {HOST.NAME}' expression: 'last(/App Nginx by Alex Gluck/nginx.active.connect)>{$NGINX_CON_NUM}' recovery_expression: 'last(/App Nginx by Alex Gluck/nginx.active.connect)<{$NGINX_CON_NUM}*0.8' - uuid: ceb41ec8a42d45ef91059718b9822efd name: 'Nginx: connections waiting' type: DEPENDENT key: nginx.waiting delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - 'Waiting:(.*)' - \0 - type: REGEX parameters: - \d+ - \0 master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx - uuid: 52e5b241c89e47e4833c2451d23413fd name: 'Nginx: connections writing' type: DEPENDENT key: nginx.writing delay: '0' history: 33d trends: 100d preprocessing: - type: REGEX parameters: - 'Writing:(.*)' - \0 - type: REGEX parameters: - \d+ - \0 master_item: key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' tags: - tag: Application value: Nginx - uuid: 76c8c6878e5846938d75596e9d1ac1df name: 'Nginx: Number of processes $1' key: 'proc.num[nginx]' delay: 60s history: 33d trends: 100d tags: - tag: Application value: Nginx triggers: - uuid: 412dee0639734424b47db038521499c1 expression: 'last(/App Nginx by Alex Gluck/proc.num[nginx])<1' name: 'Nginx: nginx is not running on {HOST.NAME}' priority: DISASTER - uuid: 73412ca573544788bef36733238ec7b6 name: 'Get Nginx stat page' key: 'web.page.get[{$NGINX_HOST},{$NGINX_STATS_URI},{$NGINX_PORT}]' delay: 60s history: 12h trends: '0' value_type: TEXT tags: - tag: Application value: Nginx macros: - macro: '{$NGINX_CON_NUM}' value: '2500' - macro: '{$NGINX_HOST}' value: localhost - macro: '{$NGINX_PORT}' value: '80' - macro: '{$NGINX_REQ_NUM}' value: '600' - macro: '{$NGINX_STATS_URI}' value: nginx-stats dashboards: - uuid: acaa97956bf747f7b1c26a6f5810661f name: 'Nginx performance' pages: - widgets: - type: GRAPH_CLASSIC width: '12' height: '5' fields: - type: INTEGER name: source_type value: '0' - type: GRAPH name: graphid value: name: 'Nginx: Connections' host: 'App Nginx by Alex Gluck' - type: GRAPH_CLASSIC x: '12' width: '12' height: '5' fields: - type: INTEGER name: source_type value: '0' - type: GRAPH name: graphid value: name: 'Nginx: Requests' host: 'App Nginx by Alex Gluck' graphs: - uuid: 8f1d6180041e474ab8e826d1503d4ce4 name: 'Nginx: Connections' width: '600' show_work_period: 'NO' graph_items: - drawtype: DASHED_LINE color: A54F10 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.active.connect - sortorder: '1' color: 2774A4 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.writing - sortorder: '2' color: 1A7C11 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.reading - sortorder: '3' color: F63100 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.waiting - uuid: bef26c2c430e4480bb2c05a48b6af568 name: 'Nginx: Requests' width: '600' show_work_period: 'NO' graph_items: - drawtype: GRADIENT_LINE color: 1A7C11 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.requests - sortorder: '1' drawtype: BOLD_LINE color: F63100 yaxisside: RIGHT item: host: 'App Nginx by Alex Gluck' key: nginx.accepts