
本文共 3011 字,大约阅读时间需要 10 分钟。
������Prometheus+Grafana������Docker���������Linux������
������Docker ���������������������������������Docker Engine������������������������������������������ https://docs.docker.com/get-docker/ ���������������������
������Prometheus������ ������������������������Prometheus������������������
docker pull prom/prometheus
- ������Prometheus������ ���������������������������Prometheus������������������������������������������Prometheus���
- ������cAdvisor cAdvisor������������Docker���������������������������������������������������������
- ������Prometheus������Docker������ ������������������
prometheus.yml
���������cAdvisor������������������ - ������Node Exporter������Linux������ ������Node Exporter������������
- ���Node Exporter���������Prometheus ���
prometheus.yml
���������������Linux��������� - ������Grafana ������Docker������Grafana���
- ������Prometheus��������� ������Grafana��������������������������� > ������������������������������������������
- ���������Prometheus
- ���������HTTP
- URL���
http://���������IP:9090
-JSON������������������������true - ��������������� ���������������������������������������Docker Monitoring���������������������������������������������������������������
mkdir -p /etc/prometheus/prometheus.ymldocker run -d -p 9090:9090 -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
��������������������� http://���������IP:9090
������Prometheus������������
docker run -d --name cAdvisor -v /:/rootfs:ro \ -v /var/run/??.:/var/run/??:ro \ -v /sys:/sys:ro \ -v /var/lib/docker/??.:/var/lib/`docker`:ro \ -v /dev/disk/??.:/dev/disk:??:ro \ -p 8080:8080 google/cadvisor:latest
������ http://���������IP:8080
������cAdvisor������������
scrape_configs: - job_name: docker static_configs: - targets: ['���������IP:8080']
���������������Prometheus���������
docker restart prometheus
������Targets���������������cAdvisor������������������
curl -sLO https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gztar xzf node_exporter-0.17.0.linux-amd64.tar.gzmv node_exporter-0.17.0.linux-amd64 /usr/local/node_exporter
������������������������������
cat </usr/lib/systemd/system/node_exporter.service[Unit]Description=Prometheus Node Exporter for Linux[Service]ExecStart=/usr/local/node_exporter/node_exporterRestart=always[Install]WantedBy=multi-user.targetEOFsystemctl daemon-reloadsystemctl enable node_exportersystemctl start node_exporter
������ http://���������IP:9100/metrics
������Node Exporter���������
scrape_configs: - job_name: linux static_configs: - targets: ['���������IP:9100']
���������������Prometheus���
docker restart prometheus
docker run -d --name grafana -p 3000:3000 grafana/grafana:latest
������Grafana���������������������������������admin���
������������������������������������������������Prometheus+Grafana������Docker���������Linux������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
