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

《云原生监控体系构建实录:从Prometheus到Grafana的观测革命》

Prometheus+Grafana部署配置

Prometheus安装

下载Prometheus服务端

Download | PrometheusAn open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.https://prometheus.io/download/

上传至服务器,解压

tar -zxvf prometheus-3.0.1.linux-amd64.tar.gz

cd prometheus-3.0.1.linux-amd64

运行

./prometheus --config.file="prometheus.yml"

后台运行

nohup ./prometheus --config.file=prometheus.yml &

当首次访问9090端口时,时间序列数据的洪流如同宇宙背景辐射般扑面而来。

Grafana安装

Grafana是一个可视化面板(Dashboard),有着非常漂亮的图表和布局展示,功能齐全的度量仪表盘和图形编辑器,支持Graphite、zabbix、InfluxDB、Prometheus

下载地址:Download Grafana | Grafana LabsOverview of how to download and install different versions of Grafana on different operating systems.https://grafana.com/grafana/download

yum localinstall -y grafana-6.5.0-1.x86_64.rpm

systemctl start grafana-server

访问页面http://服务器IP:3000 ,默认账号、密码admin/admin

Prometheus被监控端安装插件

下载插件(此处下载一个node 和 mysql插件)

Download | PrometheusAn open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.https://prometheus.io/download/

在被监控端主机解压这两个文件

tar -zxvf node_exporter-1.8.2.linux-amd64.tar.gz 

           

node_exporter插件可直接运行

cd node_exporter-1.8.2.linux-amd64

node_exporter插件可直接运行

cd node_exporter-1.8.2.linux-amd64

nohup ./node_exporter &

mysqld_exporter需要连接到MySQL,需要授权

mysqld_exporter插件需要创建一个用户+密码的文件

tar -zxvf mysqld_exporter-0.16.0.linux-amd64.tar.gz

cd mysqld_exporter-0.16.0.linux-amd64

mysql> use mysql;

mysql> create user dbuser;

mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'dbuser'@'localhost' identified by '123456';

mysql> GRANT SELECT ON performance_schema.* TO 'dbuser'@'localhost';

创建 .my.cnf 加入以下内容

[client]

user=dbuser

password=123456

启动mysqld_exporter

nohup ./mysqld_exporter --config.my-cnf=.my.cnf &

Prometheus服务端添加被监控端

cd prometheus-3.0.1.linux-amd64
vi prometheus.yml  加入

  - job_name: system-status

    static_configs:

    - targets: ['192.168.126.50:9100']

      labels:

        instance: 7-7



  - job_name: mysql-status

    static_configs:

    - targets: ['192.168.126.40:9104']

      labels:

        instance: 7-7-mysql

​访问Prometheus   http://192.168.126.30:9090/targets

Grafana对接Prometheus

添加源数据

添加成功

Grafana添加图表

自带dashboard

下载地址

Grafana dashboards | Grafana LabsBrowse a library of official and community-built dashboards.https://grafana.com/grafana/dashboards

导入

相关文章:

  • Linux——.sh 多个阶段的串行和并行执行程序
  • 向量内积(点乘)和外积(叉乘)
  • Linux一键安装zsh终端美化插件
  • MySql自动安装脚本
  • JavaEE进阶(2) Spring Web MVC: Session 和 Cookie
  • BroadcastReceiver的应用
  • 算法 之 堆
  • Rat工具:XiebroC2 一款国产C2工具简单使用介绍
  • 第四章:反射-Reflecting Your World《Unity Shaders and Effets Cookbook》
  • 2025.3.3-2025.3.9学习周报
  • 零基础上手Python数据分析 (1):Windows环境配置与开发工具,开启数据科学之旅!
  • Spring Cloud Gateway 笔记
  • 微软程序的打包格式MSIX
  • [项目]基于FreeRTOS的STM32四轴飞行器: 五.Motor驱动
  • Llama factory微调后的模型怎么通过ollama发布
  • Android 调用c++报错 exception of type std::bad_alloc: std::bad_alloc
  • 防火墙IPSec (无固定IP地址---一对多)
  • C++之vector类(超详解)
  • 【UCB CS 61B SP24】Lecture 28 - Tries 学习笔记
  • 使用 Elastic-Agent 或 Beats 将 Journald 中的 syslog 和 auth 日志导入 Elastic Stack
  • php网站开发专业/如何快速搭建网站
  • 做非法网站判什么邢/广告资源发布平台
  • wordpress更多的模板/seo的优化方向
  • 做app网站的软件叫什么名字/网络营销专业代码
  • 汕头网站建站公司/网络营销品牌
  • 自己公司网站如何添加qq/seo教程下载