docker部署prometheus、grafana进行监控
有的操作系统或服务器会在执行prometheus容器读取yml配置文件时会报权限问题。会回执 例 0:0 这个也是我在docker-compose中配置的user字段。操作系统:openEuler 24.03。服务器型号:Kunpen-920。架构:aarch64。
·
生命无罪,健康万岁,我是laity。
我曾七次鄙视自己的灵魂:
第一次,当它本可进取时,却故作谦卑;
第二次,当它在空虚时,用爱欲来填充;
第三次,在困难和容易之间,它选择了容易;
第四次,它犯了错,却借由别人也会犯错来宽慰自己;
第五次,它自由软弱,却把它认为是生命的坚韧;
第六次,当它鄙夷一张丑恶的嘴脸时,却不知那正是自己面具中的一副;
第七次,它侧身于生活的污泥中,虽不甘心,却又畏首畏尾。
说明
操作系统:openEuler 24.03
架构:aarch64
服务器型号:Kunpen-920
拉取镜像
docker pull docker.1panel.live/prom/prometheus:latest # 普罗米修斯
docker pull docker.1panel.live/grafana/grafana:latest # web可视化界面
docker pull docker.1panel.live/prom/node-exporter:latest # 监控服务器本机CPU及内存等信息
docker pull docker.1panel.live/google/cadvisor:latest # 监控docker 容器
docker-compose
version: "3.7"
services:
node-exporter:
image: docker.1panel.live/prom/node-exporter:latest
container_name: node-exporter
ports:
- "9100:9100"
restart: always
prometheus:
user: "0:0"
image: docker.1panel.live/prom/prometheus:latest
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- "./prometheus/conf/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
grafana:
image: docker.1panel.live/grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
restart: always
配置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: ['prometheus:9090']
- job_name: 'node'
static_configs:
- targets: ['node-exporter:9090']
启动
docker-compose up -d
问题
有的操作系统或服务器会在执行prometheus容器读取yml配置文件时会报权限问题
stat -C “%u:%g” ./prometheus/conf/prometheus.yml
会回执 例 0:0 这个也是我在docker-compose中配置的user字段
鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。
更多推荐



所有评论(0)