Skip to content

Prometheus exporter for Prusa3D printers - supports Prusa Link API and Syslog metrics as well as logs from printer

License

Notifications You must be signed in to change notification settings

pstrobl96/prusa_exporter

Repository files navigation

docker rpi issues go tag license

Prusa Exporter - formerly Buddy Link Prometheus Exporter

This is an implementation of Prometheus Exporter for Prusa printers running Buddy boards (Prusa MK4, XL, and Mini), Einsy boards (Prusa MK3(S(+)) with Prusa Link installed) or resin printers (SL1). Multi-target is supported out of the box so you can check any number of printers as long it has accessible Prusa Link API and you have enough computing power.

For MK3S with Einsy board you need to use at least version 0.7.0 of Prusa Link or higher, because there are many more metrics to scrape than in the older versions. You can find the most up to date version in the Prusa Link repository.

Where to find prusa exporter

Prusa exporter runs on port 10009, but you can choose different port in prusa.yml. Metrics are accessible at /metrics endpoint.

Roadmap

This list contains current and future features along with completion status:

  • Scrape of metrics from Prusa Link
  • Use of Grafana Cloud
  • CI pipeline with Docker Hub publish
  • Local instance of Grafana / Prometheus / Loki
  • Raspberry Pi Image
  • Support for connection to Einsy with username and password
  • Support for MK3 - it was implemented before but I want overhaul it and make it work
  • Dashboard update
  • Configuration update
  • Send logs to Grafana Cloud
  • Enable node_exporter for Grafana Cloud
  • Optimize and get more syslog metrics
  • Automatically send syslog config gcode to buddy boards
  • exporter toolkit implemenation
  • Create endpoint for configuration update
  • Unit tests
  • Create systemd service for exporter and install script
  • Properly provision on premise setup
  • CI for binaries release
  • Enable log collection to Loki
  • SL1 support

How to install prusa exporter

Git Clone

First things first. You need to clone the repo and that which is very easy, right?

git clone https://github.com/pstrobl96/prusa_exporter.git

Docker Compose

I've created docker-compose.yaml file, that can be used for deploy of exporter. You would need Docker and docker-compose plugin installed. Right now it is possible to use docker compose up or if you want to try newest codebase, then just run sudo docker compose -f docker-compose.testing.yaml up --build --force-recreate that will build new docker image of exporter with Grafana Agent.

Logs

Printer logs and detailed metrics are sent via Syslog which is not best option but it is what it is. However to get data to Loki I need to process logs in exporter. I wanted to use Promtail for forwarding the logs to Loki however I was not successful with this approach because Promtail was throwing EOL errors so I forward logs into file in exporter and I configured Promtail to scrape and parse them. You can find how to configure logs in config.md and exporter.md

Metrics

Metrics that you can find in this exporter are "scraped" from two sources. First is Prusa Link, it is pretty usual REST API that returns all data in JSON. There is a lot of useful metrics but there are few that are missing. Like data from most of sensors and for example current or voltage. However this is not applicable to Einsy printers like MK3, these supports only Prusa Link API. As well as resin printers like SL1. You can find how to configure metrics in config.md and exporter.md

For Buddy - SYSLOG exists. Syslog is standard for logging for a quite while however printer used it for sending metrics. Trough UDP. So what I just did is that I created experimental Syslog UDP server within this exporter and I'm catching these "metrics". Be aware that these metrics can be send only via wired ethernet. You are out of luck over the air.

The issue is that if you have more printers you'll create a lot of UDP traffic in the network. If you have more printers this number multiplies. I choose flag this feature experimental because you cannot be sure you'll get the metrics, it's UDP and printers are sending data as much as they can but it is not consistent. Between printers there are differences - obvisouly.

Example how metrics looks can be found in this file. This file also includes Einsy and Buddy syslog metrics.

How to config Syslog metrics you can find in documentation.

Raspberry Pi

I also created Raspberry Pi image that can be flashed to memory card. If you choose this path you'll need following.

  • Raspberry Pi (4 and 5 tested) with 64 bit support
  • At least Class 10 and at least 16 gigs Memory card - preferably some kind of durable one

Of course all other accessories like computer, card reader, power supply etc. are mandatory. How to flash Raspberry Pi image you can find in documentation

Starting

Starting of exporter is simple. Just change directory to where docker-compose.yaml and configs are and run following command.

docker compose up

🎉 if everthing went alright your instance is up and running and you can find metrics at /metrics endpoint.

Grafana Dashboards

I also prepared one dashboard per board which you can find in the docs/examples/grafana folder.

Prusa Link

Download this dashboard straight from Grafana.net! Just use ID 20393 when importing.

dashboard

Syslog

Download this dashboard straight from Grafana.net! Just use ID 20618 when importing.

dashboard

Overview

This dashboard is used for monitoring all of your printers. Basically - green means printing, blue means ready, yellow means warning and red is error. You need polystat panel for this dashboard.

Download this dashboard straight from Grafana.net! Just use ID 20449 when importing.

dashboard

About

Prometheus exporter for Prusa3D printers - supports Prusa Link API and Syslog metrics as well as logs from printer

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages