Zabbix v6 NGINX Monitor
NGINX Module with-http_stub_status_module
Setup ngx_http_stub_status_module and test availability with:
nginx -V 2>&1 | grep -o with-http_stub_status_module
with-http_stub_status_module
Add the following server block to your default server config - e.g. /etc/nginx/conf.d/default.conf
:
server {
listen 7777;
#Zabbix server health check
location = /basic_status {
stub_status;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
I have chosen the port 7777
and path /basic_status
:
curl http://127.0.0.1:7777/basic_status
Active connections: 5
server accepts handled requests
650525 650525 15215864
Reading: 0 Writing: 1 Waiting: 4
So this is working!
Zabbix Agent
And add the following macros - according to the URL path and port configured above:
Name | Description | Value |
---|---|---|
{$NGINX.DROP_RATE.MAX.WARN} | The critical rate of the dropped connections for trigger expression. | 1 |
{$NGINX.RESPONSE_TIME.MAX.WARN} | The Nginx maximum response time in seconds for trigger expression. | 10 |
{$NGINX.STUB_STATUS.HOST} | Hostname or IP of Nginx stub_status host or container. | localhost or 127.0.0.1 |
{$NGINX.STUB_STATUS.PATH} | The path of Nginx stub_status page. | basic_status |
{$NGINX.STUB_STATUS.PORT} | The port of Nginx stub_status host or container. | 7777 |
A few minutes later...