一、搭建
step 1 拉取镜像
docker pull prom/node-exporter #用来监控系统CPU、内存、硬盘等
docker pull prom/prometheus
docker pull grafana/grafana
docker pull google/cadvisor #用来监控容器
step2 创建prometheus配置文件路径,编辑配置文件
mkdir prometheus
cd prometheus
vim prometheus.yml
prometheus.xml文件
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# Override the global defaul