Skip to content

Instantly share code, notes, and snippets.

@128f
Last active April 12, 2023 00:29
Show Gist options
  • Save 128f/fcf885e20391ce19e0dbb630f4c3918e to your computer and use it in GitHub Desktop.
Save 128f/fcf885e20391ce19e0dbb630f4c3918e to your computer and use it in GitHub Desktop.
version: '3'
services:
prometheus:
network_mode: "host"
image: prom/prometheus
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- ./prometheus:/etc/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
grafana:
network_mode: "host"
user: 1000:1000
image: grafana/grafana
container_name: grafana
restart: always
ports:
- "3000:3000"
volumes:
- ./grafana:/var/lib/grafana
openstack-exporter:
network_mode: "host"
# docker run -v "$HOME/.config/openstack/clouds.yml":/etc/openstack/clouds.yaml -it -p 9180:9180 ghcr.io/openstack-exporter/openstack-exporter:latest microstack
image: ghcr.io/openstack-exporter/openstack-exporter:latest
container_name: openstack-exporter
command: microstack
volumes:
- /home/ubuntu/.config/openstack/clouds.yaml:/etc/openstack/clouds.yaml
restart: always
ports:
- "9180:9180"
libvirt-exporter:
network_mode: "host"
image: libvirt-exporter-local
container_name: libvirt-exporter
volumes:
- /var/snap/microstack/common/run/libvirt:/var/run/libvirt
restart: always
ports:
- "9177:9177"
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9177', 'localhost:9180']
[Unit]
Description=Monitoring for libvirt and openstack
[Service]
WorkingDirectory=/home/ubuntu/monitor
RemainAfterExit=true
ExecStart=/usr/bin/docker-compose up -d --remove-orphans
ExecStop=/usr/bin/docker-compose down
Type=oneshot
[Install]
WantedBy=multi-user.target
@128f
Copy link
Author

128f commented Apr 12, 2023

network_mode: host is just a hack here, I think it may not be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment