Description
Describe the bug
I am setting up a stack with glances, prometheus and grafana using docker compose. I started with an example provided here which did not work as I got a 401 unauthorized error on Influxdb, which is why I decided to try Prometheus instead.
So this is the docker file I am currently working with
services:
glances:
container_name: glances
image: nicolargo/glances:dev
restart: unless-stopped
environment:
- GLANCES_OPT=-q --export prometheus --time 10
pid: "host"
privileged: true
network_mode: "host"
depends_on:
- prometheus
ports:
- 9091:9091
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./cfg/glances/glances.conf:/glances/conf/glances.conf
prometheus:
image: prom/prometheus:latest
restart: unless-stopped
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./cfg/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/pormetheus
grafana:
container_name: grafana
image: grafana/grafana
restart: unless-stopped
ports:
- 8080:3000
user: "1000"
depends_on:
- prometheus
volumes:
- grafana_data:/var/lib/grafana
networks:
- grafana_network
volumes:
# define persistence volumes
prometheus_data:
grafana_data:
networks:
grafana_network:
name: grafana_network
driver: bridge
driver_opts:
com.docker.network.bridge.name: br_grafana
and the configuration files are
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'glances_exporter'
scrape_interval: 5s
static_configs:
- targets: ['0.0.0.0:9091']
and glances specific section
[prometheus]
host=0.0.0.0
port=9091
#prefix=glances
labels=src:glances
Expected behavior
I expected to see at least something in prometheus time series database, but I get nothing. What is interesting is that, in glances container, I get
2025-07-10 08:29:37,532 -- INFO -- Start Glances 4.4.0_dev1
2025-07-10 08:29:37,533 -- INFO -- CPython 3.12.11 (/venv/bin/python3) and psutil 7.0.0 detected
2025-07-10 08:29:37,551 -- INFO -- Read configuration file '/etc/glances/glances.conf'
2025-07-10 08:29:38,846 -- INFO -- Start GlancesStandalone mode
2025-07-10 08:29:40,009 -- INFO -- Start Prometheus exporter on localhost:9091
2025-07-10 08:29:40,908 -- INFO -- Quiet mode is ON, nothing will be displayed
what seems odd to me is that it keeps saying "start prometheus exporter on localhost", even though I said 0.0.0.0 in configuration file AND, if I change it to some other ip address in config file, stays fixed to localhost. I tried passing the actual host ip address (changing it in prometheus as well) but still no luck. Am I missing something?
Environement
- Operating System (lsb_release -a or OS name/version): Dockerized on Windows 11
- Glances & psutil versions: glances 4.4.0_dev1, psutil 7.0.0
- How do you install Glances (Pypi package, script, package manager, source): docker compose