配置文件
文件目录
prometheus
|-- docker-compose.yml
|-- prometheus.yml
docker-compose.yaml
version: '2'
services:
prometheus:
image: prom/prometheus:v2.5.0
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- '9090:9090'
network_mode: host
grafana:
image: grafana/grafana:5.3.2
volumes:
- grafana_data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
depends_on:
- prometheus
ports:
- '3000:3000'
volumes:
grafana_data: {}
prometheus_data: {}
prometheus.yml
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'golang'
scrape_interval: 5s
static_configs:
- targets: ['172.20.18.87:8080']
网友评论