#more prometheus-compose.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'nginx_exporter'
static_configs:
- targets: ['nginx_exporter:9113']
labels:
group: 'services'
#more datasource-compose.yaml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
basicAuth: false
isDefault: true
version: 1
editable: true
docker stop $(docker ps -q)
docker rm $(docker ps -aq)
version: '3'
services:
nginx:
image: nginx-exporter:v0.2
networks:
webnet:
aliases:
- "nginx_exporter"
expose:
- "9113"
ports:
- "9113:9113"
prometheus:
image: prom/prometheus
volumes:
- ./prometheus/prometheus-compose.yml:/etc/prometheus/prometheus.yml
networks:
webnet:
aliases:
- "prometheus"
expose:
- "9090"
ports:
- "9090:9090"
depends_on:
- nginx
grafana:
image: grafana/grafana
volumes:
- ./grafana/dashboards/dashboard.json:/var/lib/grafana/dashboards/dashboard.json
- ./grafana/provisioning/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
- ./grafana/provisioning/datasource-compose.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
networks:
webnet:
aliases:
- "grafana"
expose:
- "3000"
ports:
- "3000:3000"
depends_on:
- prometheus
networks:
webnet: {}