当前位置: 首页 > news >正文

docker-compose安装node-exporter, prometheus, grafana

基础

exporter提供监控数据
prometheus拉取监控数据
grafana可视化监控数据

准备

全部操作在/root/mypromethus中执行

node_exporter

docker-compose -f node-exporter.yaml up -d
# web访问,查看node_exporter采集到的数据
http://192.168.1.102:9101/metrics/

node-exporter.yaml

version: '3.8'
services:node_exporter:image: prom/node-exporter:v1.6.0container_name: node_exportercommand:- '--path.rootfs=/host'pid: hostrestart: unless-stoppedenvironment:- TZ=Asia/Shanghaiports:- 9101:9100volumes:- '/:/host:ro,rslave'

prometheus

docker-compose -f dcprometheus.yaml up -d
# web访问
http://192.168.1.102:9102
# 修改权限
chmod 777 prometheus_data

dcprometheus.yaml

prometheus:image: prom/prometheus:v2.37.9restart: alwayscontainer_name: prometheushostname: prometheusenvironment:- TZ=Asia/Shanghaiports:- 9102:9090command:- '--config.file=/etc/prometheus/prometheus.yml'- '--storage.tsdb.path=/prometheus'- '--web.console.libraries=/usr/share/prometheus/console_libraries' - '--web.console.templates=/usr/share/prometheus/consoles' - '--storage.tsdb.retention.time=7d'- '--web.external-url=http://192.168.1.102:9090/'volumes:- /root/myprometheus/prometheus_cnf/prometheus.yml:/etc/prometheus/prometheus.yml- /root/myprometheus/prometheus_data:/prometheus

prometheus_cnf/prometheus.yml

# my global config
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: 'node-exporter'static_configs:- targets: ['192.168.1.102:9101']# 需要修改 node-exporter servicelabels:host: myhost01# 添加标签

grafana

docker-compose -f grafana.yaml up -d
# web访问
http://192.168.1.102:9103
admin/admin
# 修改权限
chomd 777 plugins
# 添加prometheus
http://192.168.1.102:9102
# 添加dashboard,import dashboard,在grafana官网找dashboard id
https://grafana.com/grafana/dashboards/

grafana.yaml

grafana:image: grafana/grafana:10.1.0-ubunturestart: alwayscontainer_name: grafanahostname: grafanaenvironment:- TZ=Asia/Shanghaivolumes:#- /opt/grafana/defaults.ini:/etc/grafana/grafana.ini- /root/myprometheus/grafana_data/plugins:/var/lib/grafana/pluginsports:- 9103:3000

问题

  • prometheus和grafana目录权限问题

参考

  • https://blog.csdn.net/qingwufeiyangxz/article/details/108659681
  • https://grafana.com/grafana/dashboards
http://www.lryc.cn/news/152683.html

相关文章:

  • 企业架构LNMP学习笔记10
  • [国产MCU]-W801开发实例-I2C控制器
  • 植物根系基因组与数据分析
  • 2.3 数据模型
  • RT-Thread 中断管理学习(一)
  • 学习周报9.3
  • win10 查看指定进程名的端口号
  • 函数的递归调用
  • 李宏毅机器学习笔记:RNN循环神经网络
  • 基于JavaWeb和mysql实现校园订餐前后台管理系统(源码+数据库)
  • CNN 01(CNN简介)
  • AI大模型的使用-让AI帮你写单元测试
  • vscode调教配置:快捷修复和格式化代码
  • pear admin 后端启动
  • C++:输出系统时间(及报错处理)
  • 使用Windbg动态调试排查软件启动不了的问题
  • Swift 技术 视频播放器滚动条(源码)
  • PixelSNAIL论文代码学习(2)——门控残差网络的实现
  • WebGPU学习(9)---使用Pipeline Overridable Constants
  • javaweb入门版学生信息管理系统-增删改查+JSP+Jstl+El
  • 云原生Kubernetes:K8S概述
  • nmap的使用
  • Python爬虫-某网酒店数据
  • 了解atoi和offsetof
  • 命令行编译VS工程
  • Linux防火墙命令
  • 大数据平台数据脱敏是什么意思?有哪些方案?
  • 前后端分离不存在会话,sessionid不一致问题
  • Python 3+ 安装及pip配置
  • StarRocks入门到熟练