vim /home/prometheus/prometheus.yml
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# 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"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'docker'
static_configs:
- targets: ['localhost:8080']
docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:ro \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--volume=/cgroup:/cgroup:ro \
--privileged=true \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor
docker run -d --name=prometheus -p 9090:9090 -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:latest
docker run -d \
-p 3000:3000 \
--restart=always \
--name=grafana \
-e "GF_SECURITY_ADMIN_PASSWORD=admin" \
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,raintank-worldping-app,grafana-piechart-panel" \
grafana/grafana
http://127.0.0.1:3000/ 默认账号:admin 密码:admin
添加数据源
![](https://img.haomeiwen.com/i22615724/71669f3aab6af83f.png)
![](https://img.haomeiwen.com/i22615724/cbc5754014304c83.png)
![](https://img.haomeiwen.com/i22615724/a746418ba7eab8da.png)
导入
![](https://img.haomeiwen.com/i22615724/14f2efbc31965fe3.png)
![](https://img.haomeiwen.com/i22615724/82a7d5e8b03b8ed9.png)
![](https://img.haomeiwen.com/i22615724/7597bbde36959041.png)
![](https://img.haomeiwen.com/i22615724/c323abd3130538e9.png)
网友评论