本章内容如下:

Prometheus 介绍
Prometheus 部署和配置
Node Exporter 采集数据
Pushgateway 采集数据
PromQL 查询语言
Grafana 图形化展示
Prometheus 标签管理
Prometheus 告警机制
Prometheus 服务发现
各种 Exporter 高级功能
Prometheus 实现容器监控
Prometheus 联邦 Federation
Prometheus 远程存储 VictoriaMetrics
Kubernetes 集成 Prometheus

1.Prometheus 介绍

官方文档:

https://prometheus.io/docs/
https://prometheus.io/docs/introduction/overview/
Prometheus 的主要模块包括:
●prometheus 时序数据存储、监控指标管理
●可视化
Prometheus web UI : 集群状态管理、promQL
Grafana:非常全面的可视化套件
●数据采集
Exporter: 为当前的客户端暴露出符合 Prometheus 规格的数据指标,Exporter 以守护进程的模式运行井开始采集数据,Exporter 本身也是一个http_server 可以对http请求作出响应返回数据 (K/V形式的metrics)
Pushgateway : 拉模式下数据的采集工具
●监控目标 服务发现 :文件方式、dns方式、console方式、k8s方式
●告警: alertmanager
Prometheus 由几个主要的软件组件组成,其职责概述如下:

工作流程

●Prometheus server 定期从配置好的 jobs 或者 exporters 中拉取Pull metrics,或者接收来自
  Pushgateway 发过来的 metrics,或者从其他的 Prometheus server 中拉 metrics
●Prometheus server 在本地存储收集到的 metrics,并运行已定义好的 alert rules,记录新的时间    序列或者向 Alertmanager 推送警报,实现一定程度上的完全冗余功能。
●Alertmanager 根据配置文件,对接收到的警报进行去重分组,根据路由配置,向对应主机发出      告警。
●集成Grafana或其他API作为图形界面,用于可视化收集的数据。


Prometheus 只负责时序型指标数据的采集及存储

2.Prometheus 部署和配置

①ubuntu包安装

apt install prometheus            其他安装略

#访问如下链接可以看到如下显示
http://<prometheus服务器IP>:9090

#浏览器访问prometheus的指标:
http://<prometheus服务器IP>:9090/metrics

Dashboard 菜单说明

我们选择一个监控项"scrape_duration_seconds",然后点击"Execute",查看效果

查看所有的监控项: 10.0.0.203:9090/api/v1/label/__name__/values

API访问

https://prometheus.io/docs/prometheus/latest/management_api/
https://prometheus.io/docs/prometheus/latest/querying/api/

注意:{ip:port} Prometheus所在的IP和端口
●健康检查 GET {ip:port}/-/healthy  该端点始终返回200,应用于检查Prometheus的运行状况。
●准备检查 GET {ip:port}/-/ready    当Prometheus准备服务流量(即响应查询)时,此端点返回200
●加载配置 PUT {ip:port}/-/reload   POST {ip:port}/-/reload
●关闭服务  PUT {ip:port}/-/quit      POST {ip:port}/-/quit

[root@ubuntu2204 ~]#cat /lib/systemd/system/prometheus.service
......
[Service]
ExecStart=/usr/local/prometheus/bin/prometheus --
config.file=/usr/local/prometheus/conf/prometheus.yml --web.enable-lifecycle
......

[root@ubuntu2204 ~]#curl http://prometheus.wang.org:9090/-/healthy
[root@ubuntu2204 ~]#curl http://prometheus.wang.org:9090/-/ready

优化配置
Prometheus 命令支持选项如下:
https://prometheus.io/docs/prometheus/latest/command-line/prometheus/

②Node Exporter 安装  

其他安装方式略

安装 Node Exporter 用于收集各 node 主机节点上的监控指标数据,监听端口为9100
 
github 链接   https://github.com/prometheus/node_exporter
官方下载  https://prometheus.io/download/
在需要监控的所有节点主机上进行安装
[root@node1 ~]#wget -P /usr/local/ 
https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-
1.2.2.linux-amd64.tar.gz 
[root@node1 ~]#cd /usr/local
[root@node1 local]#tar xvf node_exporter-1.2.2.linux-amd64.tar.gz 
[root@node1 local]#ln -s node_exporter-1.2.2.linux-amd64 node_exporter
[root@node1 local]#cd node_exporter
[root@node1 node_exporter]#mkdir bin
[root@node1 node_exporter]#mv node_exporter bin/
[root@node1 ~]#useradd -r -s /sbin/nologin prometheus 
[root@node1 ~]#chown -R prometheus:prometheus /usr/local/node_exporter/
Prometheus 采集 Node Exporter 数据
修改 Prometheus 配置文件

关键点儿提炼:

- job_name: 'node_exporter'   #添加以下行,指定监控的node exporter节点metrics_path: /metrics      #指定路径,此为默认值,可省略scheme: http                #指定协议,此为默认值,可省略static_configs:  
- targets: ['10.0.0.104:9100','10.0.0.105:9100','10.0.0.106:9100']

个人实际实践,只需要在原有的node上添加即可

Prometheus 验证 Node 节点状态数据 node_cpu_seconds_total

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/98654.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/98654.shtml
英文地址,请注明出处:http://en.pswp.cn/diannao/98654.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

EPNN:基于嵌入式偏振神经网络的水下成像增强方法(未做完)

Enhancing Underwater Imaging for Robot through Embedded Polarization Neural Network EPNN:基于嵌入式偏振神经网络的水下成像增强方法 1 论文核心概念 本文提出了一种名为嵌入式偏振神经网络(Embedded Polarization Neural Network, EPNN) 的方法,用于显著提升水下…

基于单片机冷藏运输车环境检测/水产品运输环境检测设计

传送门 &#x1f449;&#x1f449;&#x1f449;&#x1f449;单片机作品题目速选一览表&#x1f680; &#x1f449;&#x1f449;&#x1f449;&#x1f449;单片机作品题目功能速览&#x1f680; &#x1f525;更多文章戳&#x1f449;小新单片机-CSDN博客&#x1f68…

基于STM32设计的人体健康监护系统(华为云IOT)_280

文章目录 一、前言 1.1 项目介绍 【1】项目开发背景 【2】设计实现的功能 【3】项目硬件模块组成 【4】设计意义 【5】国内外研究现状 【6】摘要 1.2 设计思路 1.3 系统功能总结 1.4 开发工具的选择 【1】设备端开发 【2】上位机开发 1.5 参考文献 1.6 系统框架图 1.7 系统原理…

先买实现烦过

#include <myhead.h> #define ERR_LOG(msg)do{perror(msg);printf("%d %s %s\n",__LINE__,__func__,__FILE__);}while(0) //定义TFTP默认端口号&#xff08;69&#xff09;和数据包大小&#xff08;516字节&#xff09; #define PORT 69 #define N 516 …

ACD智能分配:轮流分配和排序上限分配的设置

在客户服务中&#xff0c;合理的对话分配是提高服务质量的关键。一洽客服系统针对不同业务场景,提供灵活的客服分配策略,帮助企业实现智能化的客户服务管理&#xff0c;今天我们了解一下对话的轮流分配、排序上限分配、排序优先分配的设置一、轮流分配按照客服登录系统的先后顺…

【postMan / apifox 文件上传】

apifox 需要提供相关插件 失败的请求 { “timestamp”: “2025-09-10T14:44:24.91900:00”, “status”: 500, “error”: “Internal Server Error”, “path”: “/student/import” } 错误&#xff1a;Post “http://localhost:8080/student/import”: dial tcp [::1]:8080:…

视频加水印,推荐使用运营大管家-视频批量加水印软件

运营大管家-视频批量加水印软件介绍“运营大管家-视频批量加水印”是一款功能强大的桌面应用程序&#xff0c;旨在帮助用户高效地为多个视频批量添加自定义水印。无论是品牌宣传、版权保护&#xff0c;还是个性化展示&#xff0c;本软件都能提供灵活的文字水印和图片水印选项&a…

基于 Dockerfile 构建镜像

1.准备构建上下文[roothost1 ~]# mkdir dockerfile-test && cd dockerfile-test [roothost1 dockerfile-test]# touch nginx.repo [roothost1 dockerfile-test]# touch Dockerfile [roothost1 dockerfile-test]# vi nginx.repo [roothost1 dockerfile-test]# cat nginx…

[Dify实战]插件编写- 如何让插件直接输出文件对象(支持 TXT、Excel 等)

在大多数 Dify 插件开发中,我们习惯于让插件返回结构化文本、字典或 JSON 数据。但随着应用场景拓展,例如翻译文件、生成报表、处理数据分析结果等,我们需要让插件支持“直接返回文件对象”给用户,而不是让用户复制粘贴文本再手动保存。 本文将基于实战经验,详细介绍如何…

Thread类的基本用法(上)

一、线程创建方法&#xff08;5种&#xff09;1.继承Thread类class MyThread extends Thread {Overridepublic void run() {System.out.println("MyThread is running");try {Thread.sleep(1000);} catch (InterruptedException e) {throw new RuntimeException(e);}…

ARM内存映射与启动地址重映射机制解析

目录 内存映射 1. 核心概念&#xff1a;内存映射 (Memory Map) 2. 启动过程与地址重映射 (Remapping) 关键&#xff1a;启动引脚 (Boot Pins) 这个过程可以类比&#xff1a; 3. 为什么设计成这样&#xff1f; 4. 一图流总结 图解说明&#xff1a; 核心要点&#xff1a;…

网络原理——传输层协议TCP基本认识

文章目录传输层协议TCP基本认识TCP协议的格式TCP的可靠性初步理解——确认应答机制暂时理解TCP的通信过程TCP的确认号和确认序号确认号和确认序号的意义捎带应答TCP中其他字段的理解16位窗口大小标志位标志位的本质标志位的意义以SYN ACK标志位简单理解TCP连接三次握手以FIN标…

Java HTTP响应的流式处理技术

第1章 引言 1.1 传统HTTP响应处理的局限性 在现代Web应用开发中,HTTP通信是系统间数据交换的核心方式。随着数据量的不断增长和实时性要求的提高,传统的HTTP响应处理方式逐渐暴露出诸多问题。 传统处理方式通常需要将整个HTTP响应体一次性加载到内存中,然后再进行处理。这…

D01-【计算机二级】Python(1)基本操作第41题

1、考生文件夹下存在一个文件 PY101.py&#xff0c;请写代码替换横线&#xff0c;不修改其他代码&#xff0c;实现以下功能: 键盘输入正整数 n&#xff0c;按要求把 n 输出到屏幕&#xff0c;格式要求&#xff1a;宽度为 20 个字符&#xff0c;减号字符 - 填充&#xff0c;右对…

工程师 - Onion Architecture in Software Development

Introduction 介绍 In the ever-evolving world of software development, finding the right architectural pattern is akin to selecting the foundation for a building. One such architectural paradigm that has gained recognition for its ability to promote mainta…

TightVNC功能介绍

TightVNC是一款跨平台的远程桌面工具&#xff0c;支持Windows、Linux等系统&#xff0c;通过高效压缩技术实现低带宽环境下的流畅控制。以下是详细的使用说明&#xff1a; 一、安装与配置 1. Windows系统 下载与安装 访问TightVNC官网下载安装包&#xff0c;运行后选择“Comp…

硬件 (七) ARM 软中断, IMX6ULL 点灯

一、ARM 软中断&#xff08;SVC&#xff09;&#xff1a;从用户态到内核态的桥梁软中断&#xff08;SVC&#xff0c;Supervisor Call&#xff09;是 ARM 处理器从 “非特权模式&#xff08;如 User&#xff09;” 进入 “特权模式&#xff08;如 Supervisor&#xff09;” 的核…

数据结构与算法-树和二叉树-二叉树的存储结构(Binary Tree)

树和二叉树的内容比较多&#xff0c;分成两次来发 4 树和二叉树&#xff08;Tree and Binary Tree&#xff09; 4.1 树和二叉树的定义 4.1.1 树的定义 树&#xff08;Tree&#xff09;是 n&#xff08;n>0&#xff09;个结点的有限集&#xff0c;它或为空树&#xff08;…

CentOS7 Hive2.3.8 安装图文教程

一、 安装MySQL 0.0&#xff09;查询mariadb,有就去0.1&#xff09;&#xff0c;没有就不管直接去1&#xff09; rpm -qa | grep mariadb0.1&#xff09;卸载mariadb rpm -e --nodeps 查询出来的内容二、安装MySQL 1.下载资源包 官网下载 MySQL官网下载地址:https://dev.m…

开发避坑指南(43):idea2025.1.3版本启动springboot服务输入jvm参数解决办法

问题 最近装了新版IDEA尝尝新特性&#xff0c;IntelliJ IDEA 2025.1.3&#xff0c;可是在运行springboot服务的时候&#xff0c;找了好久才找到输入jvm启动参数的地方。如上图&#xff0c;不像旧版的IDEA&#xff0c;在Run/Debug Configurations->Configuration->Environ…