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

[小白系列]Ubuntu安装教程-安装prometheus和Grafana

Docker安装prometheus

拉取镜像

docker pull prom/prometheus

配置文件prometheus.yml

在/data/prometheus/建立prometheus.yml配置文件。(/data/prometheus/可根据自己需要调整)

global:scrape_interval:     15s # By default, scrape targets every 15 seconds.# Attach these labels to any time series or alerts when communicating with# external systems (federation, remote storage, Alertmanager).external_labels:monitor: 'codelab-monitor'# 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'# Override the global default and scrape targets from this job every 5 seconds.scrape_interval: 5sstatic_configs:- targets: ['localhost:9090']

启动服务

(/data/prometheus 改为你的目录)

docker run -d --name prometheus --restart always -p 9090:9090 -v /data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml   prom/prometheus

启动时加上--web.enable-lifecycle启用远程热加载配置文件
调用指令是curl -X POST http://localhost:9090/-/reload 

访问

http://IP:9090/query

IP改为你服务器的IP地址

Docker安装Grafana


拉取镜像

docker pull grafana/grafana-oss

启动

docker run -d --name=grafana --restart always  -p 3000:3000 grafana/grafana-oss

访问

http://IP:3000

默认用户名密码 admin   admin  登录提示修改密码

配置DataSource

注意添加Prometheus时可以顺便添加上Dashboards

点击import

Docker安装node-exporter

安装

docker pull prom/node-exporter
docker run -d --name node_exporter --restart always -p 9100:9100 prom/node-exporter

下面不知道干嘛的,暂时记录

docker run -d --name node_exporter --restart always -p 9100:9100  -v "/proc:/host/proc:ro"  -v "/sys:/host/sys:ro"  -v "/:/rootfs:ro"  prom/node-exporter


验证


要验证node_exporter是否成功运行,可以访问主机的9100端口,通常可以通过以下URL在浏览器中查看指标数据(假设你的Docker宿主机IP为HOST_IP):
http://HOST_IP:9100 或者 http://HOST_IP:9100/metrics

prometheus配置

在prometheus.yml中再增加一个job

 - job_name: 'node_exporter'static_configs:- targets: ['192.168.60.33:9100']

Grafana配置Node-exporter的Dashboards

dashboars地址: Grafana dashboards | Grafana Labs

找到node exporter full

选择 Copy ID to clipboard

登录grafana

填写ID,然后点击[Load]

注意选择一个配置的promethus数据源

http://www.lryc.cn/news/498479.html

相关文章:

  • Flask使用长连接
  • 数据分析思维案例:游戏评分低,怎么办?
  • 【学习总结|DAY012】Javabean书写练习
  • Mac环境下brew安装LNMP
  • openEuler 知:安装系统
  • Zephyr 入门-设备树与设备驱动模型
  • 点云标注软件SUSTechPOINTS的安装和使用,自测win10和ubuntu20.04下都可以用
  • etcd资源超额
  • AndroidStudio-常见界面控件
  • 网络协议(TCP/IP模型)
  • python 清华pip镜像源报HTTP error 403
  • swift 屏幕录制
  • 通过精密时间协议(PTP)对计算机网络中的多个设备进行时间同步
  • Docker 安装系列
  • 使用springboot-3.4.1搭建一个netty服务并且WebSocket消息通知(适用于设备直连操作,以及回复操作)
  • 4. 设计模式分类
  • Hive分区值的插入
  • 【多个图片合并成PDF】
  • Flutter动画(三)内建显式动画Widget
  • 本地运行打包好的dist
  • 什么是Layer Normalization?
  • 17. Threejs案例-Three.js创建多个立方体
  • RK3568 Android14 打开蓝牙时默认同意
  • 多模态视频大模型Aria在Docker部署
  • Ant-Design-Vue 全屏下拉日期框无法显示,能显示后小屏又位置错乱
  • AMR移动机器人赋能制造业仓储自动化升级
  • 【PHP项目实战】活动报名系统
  • 【HarmonyOS】Component组件引入报错 does not meet UI component syntax.
  • vue3项目最新eslint9+prettier+husky+stylelint+vscode配置
  • 备赛蓝桥杯--算法题目(3)