russel053/ 7 月 9, 2018/ Docker

載入Docker:

docker pull prom/alertmanager:latest
docker pull prom/collectd-exporter:latest
docker pull prom/container-exporter:latest
docker pull prom/prometheus:latest
docker pull prom/snmp-exporter:latest
docker pull grafana/grafana

建立資料夾:

mkdir /prometheus-data

建立設定檔:

nano /prometheus-data/prometheus.yml
global:
  scrape_interval:     30s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 20s # Evaluate rules every 15 seconds. The default is every 1 minute.

alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093
rule_files:
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'node'
    static_configs:
      - targets: ['10.0.1.114:9100']
  - job_name: 'pve'
    static_configs:
      - targets: ['10.0.1.114:9221']

建立Docker(註:9090如果有被Cockpit佔用請改用9091):

docker run -p 9090:9090 -v /prometheus-data/prometheus.yml:/etc/prometheus/prometheus.yml -v /prometheus-data  prom/prometheus

9091:
docker run -p 9091:9090 -v /prometheus-data/prometheus.yml:/etc/prometheus/prometheus.yml -v /prometheus-data  prom/prometheus

Grafana:

docker run -d --name=grafana -p 3000:3000 grafana/grafana
Share this Post