-
-
Notifications
You must be signed in to change notification settings - Fork 270
Filament Usage History
Spoolman has built-in support for Prometheus metrics. This lets you store a detailed history of your filament usage, which you can then view using tools like Grafana.

This is a very simplified instruction how to setup a sample instance of Prometheus and Grafana using Docker. If you want to use this long-term, please look into resources how to host these services properly.
It doesn't matter if you've installed Spoolman using the Docker or Standalone method to follow this guide.
Create a new directory to host your Prometheus and Grafana configuration and data.
Create two new directories in this directory, name them prometheus-data and grafana-data. Give them read/write access. sudo chmod 777 prometheus-data grafana-data
Create a docker-compose.yml file with the following content:
version: '3.8'
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus-data:/prometheus
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
container_name: grafana
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
ports:
- "3000:3000"
volumes:
- ./grafana-data:/var/lib/grafanaCreate a prometheus.yml file in the same directory as the docker-compose.yml with the following content. The localhost:7912 should point to your Spoolman instance, and might be changed depending on your install.
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'spoolman'
static_configs:
- targets: ['localhost:7912']Run the following command to start Prometheus and Grafana:
docker-compose up -dPrometheus will be accessible at http://localhost:9090 and Grafana at http://localhost:3000.
Set the Spoolman env variable SPOOLMAN_METRICS_ENABLED=true. This can be done in the .env file if you use the Standalone install, or in the docker-compose.yml if you use the Docker install.
Restart Spoolman after the change.
-
Access Grafana
Navigate tohttp://localhost:3000and log in with the default credentials (admin/admin). -
Add Prometheus as a Data Source
- Go to Connections > Add new connection.
- Find Prometheus in the list and click it.
- Click Add new data source.
- Set the server URL to
http://prometheus:9090and click Save & test. It should give a green box saying it was successful.
-
Create a New Dashboard
- Go to the main menu and select Dashboards > New Dashboard.
- Click Add visualization.
-
Configure the Panel
- In the Query editor, select the Prometheus data source.
- Towards the bottom of the page, click the Select metric dropdown, then choose spoolman_spool_weight_used.
- Click the blue Run queries button, some data should now show up in the graph.
- Adjust visualization settings as needed (e.g., graph, gauge).
-
Save the Dashboard
- Click Save dashboard, provide a name, and click Save.
Now, your Grafana dashboard will display the desired metrics from Prometheus!