美文网首页
搭建prometheus + grafana

搭建prometheus + grafana

作者: cain_li | 来源:发表于2018-11-22 15:16 被阅读0次

配置文件

文件目录

 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']

相关文章

网友评论

      本文标题:搭建prometheus + grafana

      本文链接:https://www.haomeiwen.com/subject/trplqqtx.html