tg44 / OctoPrint-Prometheus-Exporter

An octoprint plugin for prometheus compatible metrics endpoint
MIT License
47 stars 21 forks source link
hactoberfest octoprint-plugin prometheus prometheus-exporter

OctoPrint-Prometheus-Exporter

This is a utility plugin, which enables the prometheus server to scrape metrics from your octoprint instance. Later on, you can use data vizualisation tools (for example grafana) to track and visualize your printer(s) status(es).

This plugin has no visible UI!

Currently exported metrics:

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)

Setup

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/tg44/OctoPrint-Prometheus-Exporter/archive/master.zip

Prometheus config

Add this to the scrape_configs part of your prometheus.yml:

- job_name: 'octoprint'
    scrape_interval: 5s
    metrics_path: '/plugin/prometheus_exporter/metrics'
    static_configs:
      - targets: ['octoprint:80']

Or if you have enabled authentication:

 - job_name: 'octoprint'
    scrape_interval: 5s
    metrics_path: '/plugin/prometheus_exporter/metrics'
    params:
      apikey: ['__OCTOPRINT_APIKEY__']
    static_configs:
      - targets: ['octoprint:80']

Permission system

New in version 0.2.0: by default all users / operators have access to the metrics endpoint. If you want to make metrics accessible to anonymous users (guests) without disabling your entire authentication system simply add the metrics permission to the guest user group.

Local development/testing

dev.sh

Run bash.dev in this repository. This will

Docker

There is a docker-compose file, which will start:

You can start the stack with a regular docker-compose up -d.