Welcome! Log In Create A New Profile

Advanced

Get list of authenticated users with current connections

Posted by skechboy 
Get list of authenticated users with current connections
December 05, 2013 07:13AM
Hello,

I've been using nginx for a while for various projects, from web server for a small web pages to "load balancer" for large video streaming sites with over 500k daily visits and so far I can say it's one off the most impressive software I've ever used :-)

Back on the subject... Currently I'm working on a project that involves video streaming to, and since I'm doing some serious transcoding and other stuff with the video, in order for easier maintenance and scalability I've decided to divide my system on several servers and use nginx as proxy from whom users will take video content. This setup works great for me and its very stable and reliable for many concurrent connections, but now I'm faced with one new challenge.

Currently I'm creating web panel from where my client could easily manage its content, authorized users, user limits and similar things. I've done all this and it is working like charm the only thing that I miss is getting the list of users who have open connections to the server ( online/active users ). I'm using basic http authentication for user authentication and I'm limiting to one connection per user with limit_conn directive, here is my current setup for one location, I have N number of this in my conf file:

location /stream {
proxy_redirect off;
proxy_pass http://SOME_REMOTE_IP:xxxx;

#user authentication and limits
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
limit_conn peruser 2;
}

and peruser is set in my main config file like this:

limit_conn_zone $remote_user zone=peruser:10m

Currently I'm able to get only total number of connections to the web server with stub_status and get some estimated number of online users which is good but it will be much better if I'm able somehow to get list of authenticated users that have current connections. So my question is if this is possible, does it have some module for this job or something similar?

Any suggestions are welcomed, thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 203
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready