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

mktxp: Broken Pipe Error #1

Closed
outbackwifi opened this issue Mar 19, 2021 · 7 comments
Closed

mktxp: Broken Pipe Error #1

outbackwifi opened this issue Mar 19, 2021 · 7 comments

Comments

@outbackwifi
Copy link

OS: Ubuntu 20.04
Python: python3.8
Prometheus: running as a docker container
Grafana: 7.4.5

I am trying to setup a Mikrotik Router monitoring system with Prometheus+Grafana. I am able to get everything installed and using the cli to connect to remote router and get metrics with the mktxp print command works as expected.However, when i run the mktxp export command (either on CLI direct or through a systemd service) it throws up the following errors for every prometheus query:- 

_Exception happened during processing of request from ('172.31.58.42', 46534)
Traceback (most recent call last):
  File "/usr/lib/python3.8/socketserver.py", line 316, in _handle_request_nobloc                                                          k
    self.process_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.8/socketserver.py", line 720, in init
    self.handle()
  File "/usr/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/usr/local/lib/python3.8/dist-packages/prometheus_client/exposition.py",                                                           line 175, in do_GET
    self.wfile.write(output)
  File "/usr/lib/python3.8/socketserver.py", line 799, in write
    self.sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

would you be able to advise what is going wrong here?

@Brawn1
Copy link

Brawn1 commented Mar 20, 2021

Hy,

Broken pipe Error comes, when the client reset an established connection.
I have tested it with python:3.8-slim-buster, and it works.

So my first question, shows Grafana any metrics?

You can test it with my just created docker container. :-)
The pull-request for the docker container comes in the next few days.

You can start the container guenterbailey/mktxp with docker run command or with docker-compose.yaml.
The mktxp config directory is mounted in the docker container.

docker run -it -d --name mktxp -v <your mktxp config dir>:/root/mktxp:rw -p 0.0.0.0:49090:49090 guenterbailey/mktxp:latest

or in docker-compose.yml

version: "3"

services:
  mktxp:
    restart: on-failure
    image: guenterbailey/mktxp:latest
    volumes:
      - /volume1/mktxp/mktxp:/root/mktxp:rw
    ports:
      - "0.0.0.0:49090:49090"
    networks:
      - traefik-proxy
#    command: mktxp export

networks:
   traefik-proxy:
        external: true

@outbackwifi
Copy link
Author

thanks for this.
"So my first question, shows Grafana any metrics?" - no i cannot see any metrics on Grafana. running mktxp directly from CLI shows data from the router though.
Waiting for the pull request from you for the docker container!

Shiv

@outbackwifi
Copy link
Author

thanks for this.
"So my first question, shows Grafana any metrics?" - no i cannot see any metrics on Grafana. running mktxp directly from CLI shows data from the router though.
Waiting for the pull request from you for the docker container!

Shiv

OK - i just went ahead and pulled your docker container and ran it successfully. it seems to work well using curl. will confirm with grafana.

@outbackwifi
Copy link
Author

image
not getting any data on Grafana other than these two parameters (internet bandwidth and internet latency) and here too the values seem incorrect (916 Mb/s!)

@Brawn1
Copy link

Brawn1 commented Mar 27, 2021

good morning,

the Internet Bandwith is measured with speedtest, and the measured value is wrong, if the mktxp exporter is hosted on a Remote Server.
For bandwidth test, the mktxp exporter must running on local side.
you can, configure prometheus to request the metrics from remote side.

in prometheus.yaml

static_configs:
      - targets: [<first remote router>:49090, <second remote router>:49090]

By Internet Latency, the Label b/s is wrong, this must renamed to ms (Latency is in milliseconds).
In this pull request is the patched Dashboard Pull Request #3 .

and please, create a new issue, if it is not related on this issue. :-)

@akpw
Copy link
Owner

akpw commented Apr 1, 2021

it seems to work well using curl. will confirm with grafana.
i cannot see any metrics on Grafana. running mktxp directly from CLI shows data from the router though.

Hi @outbackwifi, just checking on the current state -- sounds like you are able to get the raw mktxp endpoint metrics via curl but still do not see it in the grafana dashboard? Regarding the latter, can you pls try out the latest version from https://grafana.com/grafana/dashboards/13679

The above exception seems to be from the prometheus client_python library that is being used in mktxp. Let me know if you still experience it, so we can then check in the prometheus-users mailing list as is suggested here or here

@akpw
Copy link
Owner

akpw commented Apr 18, 2021

closing for now, @outbackwifi pls feel free to re-open if the issue still exists on your end

@akpw akpw closed this as completed Apr 18, 2021
@eblet eblet mentioned this issue Sep 6, 2021
akpw pushed a commit that referenced this issue Aug 29, 2022
akpw pushed a commit that referenced this issue Sep 12, 2024
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

3 participants