MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

Need instructions on opeining stats port

Open Olegandr opened this issue 5 years ago • 10 comments

As last commit by @vvaltman was "mtproto: by default do not open stats port" it is now unclear how to set up it to show stats.

Olegandr avatar Jan 26 '19 22:01 Olegandr

Add --http-stats argument to the command line

AlexMTX avatar Jan 28 '19 18:01 AlexMTX

Add --http-stats argument to the command line

Please help. Can I add this argument to docker? It says: unknown flag: --http-stats

Thank you!

docker run -d -p443:443 --name=mtproto-proxy --http-stats --restart=always -v proxy-config:/data -e TAG=(mytag) -e SECRET=(mykey) telegrammessenger/proxy:latest

engelsit avatar Feb 02 '19 11:02 engelsit

I think you need to edit your docker's run.sh, check https://github.com/TelegramMessenger/MTProxy/issues/251

AlexMTX avatar Feb 02 '19 13:02 AlexMTX

was able to start wiht it, but not clear is this working at all --2019-02-02 16:36:21-- (try: 3) http://127.0.0.1:8888/stats Connecting to 127.0.0.1:8888... connected. HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers. Where those stats are stored so i could check if they are collected?

Olegandr avatar Feb 02 '19 15:02 Olegandr

wget localhost:8888/stats
nano stats

Worked for me

AlexMTX avatar Feb 02 '19 16:02 AlexMTX

Can someone please explain how to edit this file? Or maybe there is updated docker image?

WaveMeUp avatar Feb 07 '19 23:02 WaveMeUp

It was my 2nd day using Linux, so my solution may be bad.

I used "find" to locate run.sh in Docker subdirectory. And added - - http-stats to the last string, using receipt in parallel thread.

engelsit avatar Feb 07 '19 23:02 engelsit

Okay, I figured it out:

docker ps - get your container ID

sudo docker exec -it CONTAINER_ID /bin/bash
apt-get update
apt-get install nano
nano run.sh

After that add --http-stats to exec command.

exit and docker restart CONTAINER_ID

Definitely not a best solution, but it works. docker exec mtproto-proxy curl http://0.0.0.0:2398/stats

WaveMeUp avatar Feb 07 '19 23:02 WaveMeUp

It could be overriden with custom docker-compose.yml file.

thelebster avatar Aug 11 '19 15:08 thelebster

I ran into the problem that the update mirrors are old, and you can not install "nano". After connect to your Docker container sudo docker exec -it CONTAINER_ID /bin/bash you need to update the mirrors :

printf "deb http://deb.debian.org/debian/ bullseye main\ndeb-src http://deb.debian.org/debian/ bullseye main" > /etc/apt/sources.list.d/backports.list

After that it is possible to install "nano".

ausypher avatar Apr 02 '23 07:04 ausypher