Prometheus is an open-source systems monitoring and alerting toolkit.
First we need to create the
prometheus.yml configuration file. This file stores all the necessary info for scraping jobs, etc. We will be configuring it later so first create the directory for Prometheus.
# BASH [ LINUX VM ] mkdir /opt/containers/prometheus
Then create the
# BASH [ LINUX VM ] touch /opt/containers/prometheus/prometheus.yml
prometheus.yml file is created we can deploy Prometheus in docker.
Prometheus does not need a lot of environment configuration for the container as most of it is handled in the
# BASH [ LINUX VM ] curl https://bin.alexsguardian.net/raw/prometheus-compose -o /opt/containers/prometheus/prometheus-compose.yml
Now deploy Prometheus.
# BASH [ LINUX VM ] docker-compose -f /opt/containers/prometheus/prometheus-compose.yml up -d
Prometheus should now be running. However its not yet configured. In order to get any data from Prometheus we need to deploy exporters for it to scrape.
Check out my blog posts about Prometheus Exporters to get started!
- Expanding Pi-Hole Stats with PrometheusThe other day I came across a Prometheus Exporter for Pi-hole (found in a comment on /r/pihole) that gives WAY more stats/data compared to the InfluxDB script I posted about awhile back. With this exporter, I was able to setup a more detailed dashboard. Now currently I only have this setup for a single instance… Read More »Expanding Pi-Hole Stats with Prometheus
- Transmission Metrics in GrafanaIf you use Transmission as your download client, you can use a metrics exporter for Prometheus to ingest info into Grafana to display. You’ll also want to make sure Prometheus is setup and running or else this won’t work! SSH to your docker host that is running Prometheus and edit the prometheus.yml configuration file by adding the following: Save and close prometheus.yml. Now… Read More »Transmission Metrics in Grafana
You can expand off these with other exporters. Just be sure to add a job config to your
prometheus.yml file and restart Prometheus!
Prometheus is super easy to add to Grafana as it does not, by default, require any auth.
- Login to Grafana
- Hover over the settings cog
- Click Data Sources
- Then click ‘Add data source”
- Click Prometheus
- Enter ‘prometheus:9090’ in the URL field
- Click Save & Test
If you get an error make sure Prometheus was joined to the docker network ‘InfluxNet’. You can run `docker inspect prometheus-prometheus-1′ on your docker host to verify.
Look for “NetworkMode”: “InfluxNet”, in the output.