Welcome! Log In Create A New Profile

Advanced

Monitor connections

Posted by KactusMan 
Monitor connections
July 21, 2014 02:36AM
Hi,
I would like to monitor my Nginx load balancer with connection statistics (total active users, how many are on each node, etc.) similar to http://demo.nginx.com/status.html (note that I am using the "free" version of Nginx).

Does anyone know how can I accomplish this?

thank's in advance!
Re: Monitor connections
February 12, 2015 04:48PM
I've just finished a fairly deep-dive into the subject of monitoring various Nginx-related things, and perhaps can be of some help --

There are basically two ways to get good monitoring data out of Nginx "free":

1) You can setup ngx_http_stub_status_module (http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) and poll the output of that
2) You can log specific variables that relate to what you want to monitor and do calculations / analysis on the log files themselves.

If you elaborate a bit on the "etc" part of what stats you want, I can try to point you in the right direction. Total Active Users is a bit tough because the concept of a "user" is a bit murky -- but you can certainly look at connections and do some interpolation based on IP address, etc. Take a peek in particular at $connection (which assigns a serial number of each connection in a log entry) and the $server_addr / $server_name log variables.

PS - If you're interested, you can see the full piece I wrote here:

https://www.scalyr.com/community/guides/how-to-monitor-nginx-the-essential-guide

--Noah
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 79
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready