Monitoring Nginx Connections Accepted Per Second with Zabbix.
To monitor the number of connections accepted per second on an Nginx server using Zabbix, you can follow these steps:
- Install the Zabbix agent on the Nginx server if it’s not already installed. You can find instructions on how to do this on the Zabbix documentation.
- Enable the
stub_status
module in Nginx by adding the following configuration to the server block in your Nginx configuration file:
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
This will expose Nginx status information at http://localhost/nginx_status
. Make sure to test the configuration and reload Nginx.
3. Configure Zabbix to monitor the nginx.connections.accepted
metric. This metric represents the total number of accepted client connections. To do this, create a new item in Zabbix with the following parameters:
- Name: any desired name for the item
- Type: Zabbix agent
- Key:
nginx.connections.accepted
- Type of information: Numeric (unsigned)
- Update interval: any desired interval, for example, 30 seconds
4. Create a trigger to alert you when the number of connections accepted per second exceeds a certain threshold. To do this, create a new trigger with the following parameters:
- Name: any desired name for the trigger
- Expression:
delta(nginx.connections.accepted[30s])/30>100
(this will trigger if the number of connections accepted per second is greater than 100) - Severity: any desired severity, for example, warning or average
You can adjust the threshold and the interval to your needs.
That’s it! With these steps, you should now be able to monitor the number of connections accepted per second on your Nginx server using Zabbix.