-
-
Notifications
You must be signed in to change notification settings - Fork 114
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/grafana
Create 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 -d
Prometheus will be accessible at http://localhost:9090
and Grafana at http://localhost:3000
.
-
Access Grafana
Navigate tohttp://localhost:3000
and log in with the default credentials (admin
/admin
). -
Add Prometheus as a Data Source
- Go to Settings > Data Sources.
- Click Add data source and select Prometheus.
- Set the URL to
http://prometheus:9090
and click Save & test.
-
Create a New Dashboard
- Go to the main menu and select Dashboards > New Dashboard.
- Click Add a new panel.
-
Configure the Panel
- In the Query editor, select the Prometheus data source.
- Enter a query to retrieve data. For example:
rate(http_requests_total[1m])
- 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!