docker安装prometheus
目录1. 拉取镜像包2. 启动node-exporter启动访问3. 启动prometheus新建目录,生成prometheus.yaml启动prometheus访问4. 启动grafana新建目录启动访问1. 拉取镜像包docker pull prom/node-exporterdocker pull prom/prometheusdocker pull grafana/grafana...
·
目录
1. 拉取镜像包
docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
2. 启动node-exporter
启动
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
prom/node-exporter
访问
< http://192.168.1.109:9100/metrics>
3. 启动prometheus
新建目录,生成prometheus.yaml
mkdir /opt/prometheus
cd /opt/prometheus/
vim prometheus.yml
内容
global:
scrape_interval: 60s
evaluation_interval: 60s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: prometheus
- job_name: linux
static_configs:
- targets: ['192.168.1.109:9100']
labels:
instance: localhost
修改其中的192.168.1.109
为本机地址
启动prometheus
docker run -d \
-p 9090:9090 \
-v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
访问
http://192.168.1.109:9090/graph
4. 启动grafana
新建目录
mkdir /opt/grafana-storage
chmod 777 -R /opt/grafana-storage
启动
docker run -d \
-p 3000:3000 \
--name=grafana \
-v /opt/grafana-storage:/var/lib/grafana \
grafana/grafana
访问
http://192.168.1.109:3000
默认账号admin
密码admin
数据源选择prometheus
结果
参考链接
[1] https://www.cnblogs.com/xiao987334176/p/9930517.html
更多推荐
已为社区贡献1条内容
所有评论(0)