Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to see the number of active connections count? #12

Closed
hamed-shirbandi opened this issue Jun 5, 2018 · 10 comments
Closed

how to see the number of active connections count? #12

hamed-shirbandi opened this issue Jun 5, 2018 · 10 comments

Comments

@hamed-shirbandi
Copy link

i need to monitor proxies and see the number of users of them. how can i do that?

@alexbers
Copy link
Owner

alexbers commented Jun 5, 2018

The proxy prints those stats every 10 minutes. They look like this

Stats for 05.06.2018 22:06:11
tg: 29 connects (0 current), 0.04 MB
tg2: 1268 connects (0 current), 0.02 MB

If you're using docker, the docker-compose logs command can be used to see the number of active connections

@Allineer
Copy link
Contributor

Allineer commented Jul 2, 2018

@alexbers, how about more "parseable" statistics format?
For example, JSON or CSV or key=value via http(s) request or CLI command or rewriteable file like openvpn-status.log?

users=tg,tg2
tg.connects=29
tg.curr_connects=0
tg.octets=0.04
tg.msgs=111
tg2.connects=1268
tg2.curr_connects=0
tg2.octets=0.02
tg2.msgs=222
tg;29;0;0.04;111
tg2:1268;0;0.02;222

Thanks!

@seriyps
Copy link

seriyps commented Jul 2, 2018

@Allineer you can have statistics in Prometheus format if you check prometheus branch

@Allineer
Copy link
Contributor

Allineer commented Jul 2, 2018

@seriyps Спасибо!

@ParaNULL
Copy link

ParaNULL commented Jul 3, 2018

docker-compose logs doesn't echo the same output as before! it doesn't show the connection stats and numbers!

@alexbers
Copy link
Owner

alexbers commented Jul 3, 2018

do you use prometheus branch? could you send the output of docker-compose logs command (please, replace your server ip with 0.0.0.0)?

@masoudelete
Copy link

masoudelete commented Jun 5, 2019

@alexbers @seriyps Is there a way to see the number of connections when I'm running the proxy with Python command? I ran 6 instances with tmux on a 6cpu server

@alexbers
Copy link
Owner

alexbers commented Jun 7, 2019

yes, you can use netstat -tn command, like netstat -tn | wc -l

@seriyps
Copy link

seriyps commented Jun 7, 2019

@alexbers it will show both connections from clients to proxy and from proxy to telegram servers. Also, it will show other connections on the system. So, it might be bit better to use ss -nt state established '( sport = 443 )' | wc -l (here 443 is proxy port; if proxy uses different port, replace 443 with yours

@alexbers
Copy link
Owner

The Prometheus support have been merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants