一、安装prometheus
1、安装
version: '3.1'services:prometheus:image: prom/prometheus:v2.48.0container_name: prometheushostname: prometheusrestart: alwaysvolumes:- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml- ./prometheus/:/etc/prometheus/ports:- "9090:9090"
启动prometheus: docker-compose up -d prometheus
2、验证
浏览器打开 http://127.0.0.1:9090
二、安装grafana
version: '3.1'
services:grafana_v10.2.0:container_name: grafana_v10.2.0image: grafana/grafana:10.2.0restart: alwayslinks:- typcho-mysqldepends_on:- typcho-mysql ports:- "3000:3000"volumes:- ./grafana_v10.2.0/data:/var/lib/grafana- ./grafana_v10.2.0/config/grafana.ini:/etc/grafana/grafana.ini
启动prometheus: docker-compose up -d grafana_v10.2.0
2、验证
浏览器打开 http://127.0.0.1:3000
默认账号密码:admin/admin
3、配置数据源
配置prometheus地址