Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e612978
rename metrics to follow OctoPrint namespace
loelkes Nov 2, 2022
55098c6
update documentation
loelkes Nov 2, 2022
55244a0
rename metrics for jobs
loelkes Nov 3, 2022
a26f36a
refactor parse_move_args method
loelkes Nov 4, 2023
67cf38e
refactore process_line method
loelkes Nov 4, 2023
f33e232
refactor parse_fan_speed method
loelkes Nov 4, 2023
33e52f2
use raw strings for regex
loelkes Nov 5, 2023
043ccc4
remove unused method is_extrusion_move
loelkes Nov 5, 2023
ee52193
remove unused method process_axis_movement
loelkes Nov 5, 2023
b1da5e3
remove unsude attribute, fix inconsistent return
loelkes Nov 5, 2023
c4010d8
use more explicit variable naming
loelkes Nov 11, 2023
11f0a2e
docstring, remove unused code, use single quotes
loelkes Nov 11, 2023
be9d7c0
rename event related methods
loelkes Nov 11, 2023
d52bfe6
convert tab to spaces, remove trailing whitespaces
loelkes Nov 11, 2023
3db0f79
split XYZE processing in individual methods
loelkes Nov 12, 2023
b10c73f
add on_print_started method
loelkes Nov 12, 2023
8d6e9fb
add on_state_changed method
loelkes Nov 12, 2023
1b7d417
merge on_printer_offline into on_state_changed
loelkes Nov 25, 2023
f5a2ed4
refactor on_event and on_job_complete
loelkes Nov 25, 2023
ad96f98
add sample GCode file
loelkes Nov 26, 2023
e2a0b98
fix typos, linting
loelkes Nov 26, 2023
15f562e
document sudoers configuration for vcgencmd
loelkes Jan 1, 2024
b712635
merge main branch
loelkes Jan 6, 2024
766fc9b
styling, fix typos
loelkes Jan 6, 2024
83cf4d6
Merge branch 'main' into feature/metrics-naming
loelkes Feb 2, 2024
c197429
add regex prefix
loelkes Feb 2, 2024
0f7ad1a
line length
loelkes Feb 2, 2024
c6cb6f0
docstrings
loelkes Feb 2, 2024
6f258f0
fix mistake from merge
loelkes Feb 2, 2024
cc6a0c5
refactoring
loelkes Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 62 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
# OctoPrint-Prometheus-Exporter

This is a utility plugin, which enables the [prometheus server](https://prometheus.io/) to scrape metrics from your octoprint instance.
Later on, you can use data vizualisation tools (for example [grafana](https://grafana.com/)) to track and visualize your printer(s) status(es).
This is a utility plugin, which allows to scrape metrics from your OctoPrint instance using [Prometheus](https://prometheus.io/).
Later on, you can use data visualization tools (for example [Grafana](https://grafana.com/)) to track and visualize your printer(s) status(es).

This plugin has no visible UI!

Currently exported metrics:
- python version - as info
- octoprint version, hostname, os - as info
- actual temperature - as gauge with tool identifier label
- target temperature - as gauge with tool identifier label
- client number - as gauge; the actually connected clients to the host
- printer state - as info
- started prints - as counter
- failed prints - as counter
- done prints - as counter
- cancelled prints - as counter
- timelaps count - as counter
- print progress - as gauge with path label
- slice progress - as gauge with path label
- print total time - as counter
- last print time - as gauge
- fan speed - as gauge
- extrusion total - as counter
- x, y and z travel - as a counter
- last print extrusion - as gauge
- print time elapsed - as gauge
- print time estimate - as gauge
- print time left estimation - as gauge

All of the metrics are prefixed as `octoprint_` for easier identification.

The metrics endpoint is: http://localhost:5000/plugin/prometheus_exporter/metrics (change the host+port to your actual host+port)
## Metrics

All metrics are prefixed as `octoprint_` for easier identification. Metrics for distance and temperature are showed in the units configured in the 3D printer firmware.

The metrics endpoint is: /plugin/prometheus_exporter/metrics. If your OctoPrint runs on localhost:5000 this leads to http://localhost:5000/plugin/prometheus_exporter/metrics as scrape target.

### Server

* `octoprint_server_timelapses`: Counter, captured timelapses.
* `octoprint_server_slice_progress`: Gauge, slicing progress.
* `octoprint_server_clients`: Gauge, connected clients.
* `octoprint_server_info`: Info, server information.
* Contains labels `app_start`, `host`, `octoprint_version`, `platform`

### Jobs

* `octoprint_jobs_time_seconds`: Counter, combined printing time in seconds.
* `octoprint_jobs_started`: Counter, amount of started prints.
* `octoprint_jobs_failed`: Counter, amount of failed prints.
* `octoprint_jobs_done`: Counter, amount of finished prints.
* `octoprint_jobs_cancelled`: Counter, amount of cancelled prints.

### Printer

* `octoprint_printer_travel_x`: Gauge, printer travel on X axis.
* `octoprint_printer_travel_y`: Gauge, printer travel on Y axis.
* `octoprint_printer_travel_z`: Gauge, printer travel on Z axis.
* `octoprint_printer_extrusion`: Gauge, printer filament extrusion.
* `octoprint_printer_state`: Gauge, printer connection info.
* `octoprint_printer_fan_speed`: Gauge, fan speed.
* `octoprint_printer_temperatures_actual`: Gauge, reported temperatures.
* `octoprint_printer_temperatures_target`: Gauge, targeted temperatures.

### Job

* `octoprint_job_travel_x`: Gauge, print job travel on X axis.
* `octoprint_job_travel_y`: Gauge, print job travel on Y axis.
* `octoprint_job_travel_z`: Gauge, print job travel on Z axis.
* `octoprint_job_progress`: Gauge, print job progress.
* `octoprint_job_extrusion`: Gauge, print job filament extrusion.
* `octoprint_job_time_elapsed_seconds`: Gauge, print job time elapsed in seconds.
* `octoprint_job_time_est_seconds`: Gauge, print job time estimate in seconds.
* `octoprint_job_time_left_estimate_seconds`: Gauge, print job time left estimate in seconds.

### RaspberryPi

* `octoprint_raspberry_core_temperature`: Gauge, core temperature of Raspberry Pi.

You need to add the `pi` users to sudoers so it can execute the vcgencmd command without password. Create a file `/etc/sudoers.d/octoprint-vcgencmd` with
```
pi ALL=NOPASSWD: /usr/bin/vcgencmd
```

## Setup

Expand Down Expand Up @@ -72,14 +97,14 @@ New in version 0.2.0: by default all users / operators have access to the metric

### dev.sh

Run `bash.dev` in this repository. This will
* Create a Python virtual environment `venv/`
* Install Octoprint `OctoPrint>=1.4.0`
* Install this plugin
* Configure Octoprint
* Create a user. `admin:admin`
* Skip all wizards
* Enable virtual printer and autoconnect
Run `bash.dev` in this repository. This will:
* Create a Python virtual environment `venv/`.
* Install Octoprint `OctoPrint>=1.4.0`.
* Install this plugin.
* Configure Octoprint.
* Create a user `admin:admin`
* Skip all wizards.
* Enable virtual printer and connect automatically.
* Start OctoPrint in debug mode.

### Docker
Expand Down
18 changes: 18 additions & 0 deletions extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,21 @@ Currently Cookiecutter generates the following helpful extras to this folder:
![Grafana dashboard](./grafana-screenshot.png)

> This folder may be safely removed if you don't need it.

## Sample GCode Files

### xyz_calibration_cube.gcode

100 x 100 x 100mm calibration cube sliced with Cura 5.1.0 with a 0,4mm nozzle, 1,75mm filament on default *Normal 0,15mm* settings.

#### Distances
* Total distance 2724,24m
* X: 1808,27m
* Y: 1705,05m
* Z: 0,13m
* E: 62,36m
* Printing distance: 2456,59m
* Travel distance: 264,65m

#### Commands
* G0/G1: 190229
Loading