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

pubeldev/prusa_exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker issues go tag license

buymeacoffee-animated-badge

Table of Contents

prusa_exporter

Prusa Exporter or more known as prusa_exporter is a tool that allows users to expose metrics from the Prusa Research FDM 3D printers. Its approach is to scrape metrics from Prusa Link REST API and also getting UDP type of metrics. After gettng data it's simply exposes the metrics at /metrics/prusalink and /metrics/udp endpoints. You can also access http://localhost:10009.

I strongly recommend to connect printers via Ethernet as WiFi is not considered stable

UDP metrics

UDP is configured in printer - Settings -> Network -> Metrics & Log

By default at start of the exporter will send the configuration gcode to the printers that are configured in prusa.yml. The list is already prepared but you can add additional metrics by using flag udp.extra-metrics="crash,power_panic".

  • Host => address where prusa_exporter is running aka your computer / server
  • Metrics Port => default 8514 same as prusa_exporter but you can change it
  • Enable Metrics => enable
  • Metrics List => list of enabled metrics
    • You can select all but it has actual impact on performance so choose wisely

Of course you can configure metrics with gcode as well - that gcode can be found here. This list is not complete because there are constant changes in Prusa-Firmware-Buddy.

How to manually activate UDP metrics

I've prepared quick guide where you can learn how to manually activate UDP metrics in the printer. You can find it in here, in UDP.md. If you are using older firmware then you can try to use older guide but beware that it is not supported. That can be found in UDP_OLD_FW.md.

Prusa Link Metrics

Prusa Link is configured with prusa.yml where you need to fill - Settings -> Network -> PrusaLink

  • address of the printer
  • username => default maker
  • password for Prusa Link
  • name of the printer
    • your chosen name => just use basic name non standard - type
  • type - model of the printer
    • MK3.9 / MK4 / MK4S / XL / Core One ...

Guide how to get infomration from the printer

I've prepared quick guide where you can learn how to get credentials and IP address from the printer for the prusa_exporter. You can find it in here, in PRUSALINK.md

Running

Docker

I've prepared docker compose that can be run with proper tools installed. Install Docker Linux/macOS. Make sure you installed also docker compose.

If you choose to sent UDP enable g-code to registered printers in (prusa.yml) - then you have to export environment variable HOST_IP that contains IP address of the computer where exporter is running. Code contains a function to detect host IP address but it's not possible to get it running inside of Docker.

export HOST_IP=192.168.20.20
docker compose up

Or you can use startup script

./start_docker.sh

Standalone

Running exporter standalone is certainly possible and you can get binaries here in Releases. It's only way how to run it on Windows without WSL for example. Just be sure that there is prusa.yml right next to the executable.

Linux

prusa_exporter-linux-amd64

macOS

prusa_exporter-darwin-arm64

Windows

prusa_exporter-windows-amd64.exe

Flags

  • config.file
    • Configuration file for prusa_exporter
    • Default: ./prusa.yml
  • exporter.metrics-path
    • Path where to expose Prusa Link metrics
    • Default: /metrics/prusalink
  • exporter.udp-metrics-path
    • Path where to expose UDP metrics
    • Default: /metrics/udp
  • exporter.metrics-port
    • Port where to expose metrics
    • Default: 10009
  • prusalink.scrape-timeout
    • Timeout in seconds to scrape prusalink metrics in seconds
    • Default: 10
  • log.level
    • Log level for zerolog
    • Default: info
  • udp.ip-override
    • Override the IP address of the server with this value - if empty then exporter will attempt to load IP address from system
    • Default: ""
  • udp.listen-address
    • Address where to expose port for gathering metrics. - format :
    • Default: 0.0.0.0
  • udp.prefix
    • Prefix for udp metrics
    • Default: prusa_
  • udp.extra-metrics
    • Comma separated list of extra udp metrics to expose
    • Default: ""
  • udp.all-metrics
    • Expose all udp metrics. SEVERELY IMPACT CPU CAPABILITIES OF THE PRINTER!
    • Default: false
  • udp.gcode-enabled
    • Enable generating and sending metrics gcode
    • Default: true

Dashboards

I've prepared cozy dashboards, but this being Prometheus, you can do whatever you want. Fun fact, Mini dashboard works for MKx and Core One and MKx dashboard works for Core One but not vice versa. XL dashboard is specific for XL.

Prusa MKx (MK3.5(S) / MK3.9(S) / MK4(S))

mkxdashboard Dashboard

Prusa Core One

c1dashboard Dashboard

Prusa XL

xldashboard Dashboard

Prusa XL - fancy version for 5 Tools (BETA and WIP)

xl5tbetadashboard Dashboard

Prusa Mini

minidashboard Dashboard

General Overview

minidashboard Dashboard

Roadmap

rc1

  • create overview dashboard for all printers in system
  • Grafana provisioning
  • further testing

rc2

  • even more testing

final 2.0.0

  • 🎉

2.1.0

  • Easier deploy without internet
  • If possible - removal of printer_model in configuration
  • Move list of UDP metrics to separate file
  • Export udp enable g-code to the local filesystem
  • SL printer support
  • etc... list is not final

FAQ

My printer is correctly connected via Prusa Link API but I got no UDP metrics

After start of the exporter G-Code containing configuration is sent to the printer but it was not probably loaded properly. You can trigger reload by either restart of the exporter or you can run it manually on the printer.

After exporter started my printers returned Warning - The G-code isn't fully compatible

This is correct - just click on PRINT and that's it. It's possible to technically avoid this but even then you will be informed that G-Code is changing metrics configuration so it's pointless.

After I started the exporter printers wants to print enable_udp_metrics.gcode

That is correct. Don't affraid, it's not going to print anything, just start the "print".

My printer has UDP metrics host set as 172.x.x.x

That is because you haven't stared the docker compose with start_docker.sh. This script will export HOST_IP address and docker-compose will pass it into exporter.

Can I enable all UDP metrics?

Yes, but you may face the issue that MCU of the printer will not keep up and it can cause issues with printing.

Can I get also logs from the printer?

Technically yes but that is not the scode of prusa_exporter. Use prusa_log_processor instead.

Why is there Loki in docker compose? Isn't this exporter of metrics?

Well, yes. But I wanted expose png of actual print file so I've ended with using Loki. It's not necessary and you can disable by just not setting loki.push-url or setting it to "".

I don't have Prusa Link metrics. Why?

Double check the prusa.yml for typos.

Why do I have to fill printer model in configuration file?

At this moment it's not possible to get information what printer is running at the defined endpoint. So I don't even use this information in the code. If in the future will the information be available I'll use it to generate compatible metrics gcode and the prusa.yml will be bit easier to configure.

However printer model is not necessary for run of the exporter itself but it is used in Grafana dashboards where you can filter by model of the printer.

Is the docker compose production ready?

Absolutely not, you can take it as example but you should properly configure Loki, Grafana and Prometheus.

What metrics are better? UDP or Prusa Link

UDP metrics have by default 1 second of resultion while Prusa Link are scraped every 60 seconds. So because of this I'd say UDP are better but they have issue with UDP being UDP and sometimes they will just not work.

Can I run the exporter on Raspberry Pi?

Yes, I build binaries for

Linux

  • amd64
  • arm64
  • risc64
  • arm

macOS

  • arm64
  • amd64

Windows

  • arm64
  • amd64

And images for

  • linux/amd64
  • linux/arm64
  • linux/arm/v7

What UDP metrics are enabled by default?

  • active_extruder
  • bedlet_target
  • dwarfs_mcu_temp
  • dwarfs_board_temp
  • loadcell
  • side_fsensor
  • fsensor_raw
  • adj_z
  • temp_ambient
  • temp_bed
  • temp_brd
  • temp_chamber
  • temp_mcu
  • temp_noz
  • temp_hbr
  • temp_psu
  • temp_sandwich
  • temp_splitter
  • dwarf_mcu_temp
  • dwarf_board_temp
  • buddy_temp
  • bedlet_temp
  • bed_mcu_temp
  • chamber_temp
  • ttemp_noz
  • ttemp_bed
  • chamber_ttemp
  • cur_mmu_imp
  • curr_inp
  • Sandwitch5VCurrent
  • splitter_5V_current
  • bed_curr
  • bedlet_curr
  • curr_nozz
  • dwarf_heat_curr
  • xlbuddy5VCurrent
  • eth_in
  • eth_out
  • esp_in
  • esp_out
  • volt_bed
  • volt_nozz
  • 24VVoltage
  • 5VVoltage
  • loadcell_value
  • fan
  • fan_hbr_speed
  • fan_speed
  • xbe_fan
  • print_fan_act
  • hbr_fan_act
  • hbr_fan_enc
  • cpu_usage
  • heap
  • heap_free
  • heap_total
  • fsensor
  • door_sensor
  • fw_version
  • buddy_revision
  • buddy_bom

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

Sponsor this project

Packages

No packages published

Languages