Prometheus + grafana 的监控平台部署

news2024/10/6 12:23:09

一、Prometheus安装

tar -zxvf prometheus-2.44.0.linux-amd64.tar.gz -C /opt/module/
sudo chown -R bigdata:bigdata /opt/module/prometheus-2.44.0.linux-amd64
mv /opt/module/prometheus-2.44.0.linux-amd64 /opt/module/prometheus-2.44.0
ln -s /opt/module/prometheus-2.44.0 /usr/local/prometheus

1.1 修改配置文件

vim /opt/module/prometheus-2.44.0/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: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["node1:9090"]

  - job_name: 'pushgateway'
    static_configs:
    - targets: ["node1:9091"]
      labels:
        instance: pushgateway

  - job_name: 'node exporter'
    static_configs:
    - targets: ['node1:9100', 'node2:9100', 'node3:9100', 'node4:9100']

  - job_name: 'kafka_exporter'
    static_configs:
    - targets: ["node1:9308"]

  - job_name: 'clickhouse-cluster'
    static_configs:
    - targets: ['node4:9363','node3:9363','node2:9363','node1:9363']

1.2 创建数据目录

mkdir -p /data/prometheus/data
chown -R bigdata:bigdata /data/prometheus

1.3 使用systemctl管理Prometheus

sudo vim /usr/lib/systemd/system/prometheus.service
[Unit]
Description=prometheus
Documentation=https://prometheus.io/docs/introduction/overview/After=network.target
After=network.target

[Service]
Type=simple
User=bigdata
Group=bigdata
Restart=on-failure
WorkingDirectory=/usr/local/prometheus/
ExecStart=/usr/local/prometheus/prometheus --web.enable-admin-api --web.enable-lifecycle --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data
[Install]
WantedBy=multi-user.target

命令

systemctl start prometheus
systemctl enable prometheus
systemctl status prometheus

1.4 pushgateway部署

tar -zxvf /opt/software/pushgateway-1.6.0.linux-amd64.tar.gz -C /opt/module/
sudo chown -R bigdata:bigdata /opt/module/pushgateway-1.6.0.linux-amd64
sudo mv /opt/module/pushgateway-1.6.0.linux-amd64 /opt/module/pushgateway-1.6.0

修改配置文件

sudo vim /usr/lib/systemd/system/pushgateway.service
[Unit]
Description=pushgateway
Wants=prometheus.service
After=prometheus.service

[Service]
Type=simple
User=bigdata
Group=bigdata
Restart=on-failure
WorkingDirectory=/opt/module/pushgateway-1.6.0/
ExecStart=/opt/module/pushgateway-1.6.0/pushgateway --web.listen-address :9091
[Install]
WantedBy=multi-user.target

命令

sudo systemctl start pushgateway
sudo systemctl enable pushgateway
sudo systemctl status pushgateway

1.5 node_exporter部署

sudo tar -zxvf /opt/software/node_exporter-1.6.0.linux-amd64.tar.gz -C /opt/module/
sudo chown -R bigdata:bigdata /opt/module/node_exporter-1.6.0.linux-amd64
sudo /opt/module/node_exporter-1.6.0.linux-amd64 /opt/module/node_exporter-1.6.0
sudo sh /opt/bash/xsync_bigdata.sh /opt/module/node_exporter-1.6.0

分发 /opt/module/node_exporter-1.6.0 目录到需要监控的节点

使用systemctl 管理node_exporter服务

sudo vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_export
Documentation=https://github.com/prometheus/node_exporter
After=network.target
[Service]
Type=simple
User=bigdata
Group=bigdata
ExecStart= /opt/module/node_exporter-1.6.0/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target

分发到各个节点,并且启动服务

sudo systemctl start node_exporter.service
sudo systemctl status node_exporter.service
sudo systemctl enable node_exporter.service

1.6 kafka_exporter部署

sudo tar -zxvf /opt/software/kafka_exporter-1.7.0.linux-amd64.tar.gz -C /opt/module/
sudo chown -R bigdata:bigdata /opt/module/kafka_exporter-1.7.0.linux-amd64
mv /opt/module/kafka_exporter-1.7.0.linux-amd64 /opt/module/kafka_exporter-1.7.0

使用systemctl管理 kafka_exporter 服务

sudo vim /usr/lib/systemd/system/kafka_exporter.service
[Unit]
Description=kafka_exporter
Wants=prometheus.service
After=network.target prometheus.service

[Service]
Type=simple
User=bigdata
Group=bigdata
Restart=on-failure
WorkingDirectory=/opt/module/kafka_exporter-1.7.0
ExecStart=/opt/module/kafka_exporter-1.7.0/kafka_exporter --kafka.server=node2:9092 --web.listen-address=:9308 --zookeeper.server=node2:2181
[Install]
WantedBy=multi-user.target

命令

sudo systemctl start kafka_exporter
sudo systemctl enable kafka_exporter
sudo systemctl status kafka_exporter

1.7 grafana安装

sudo tar -zxvf /opt/software/grafana-enterprise-10.0.0.linux-amd64.tar.gz -C /opt/module/
sudo chown -R bigdata:bigdata /opt/module/grafana-10.0.0
sudo vim /usr/lib/systemd/system/grafana.service

使用systemctl 管理grafana 服务

[Unit]
Description=grafana
Wants=prometheus.service
After=network.target prometheus.service

[Service]
Type=simple
User=bigdata
Group=bigdata
Restart=on-failure
WorkingDirectory=/opt/module/grafana-10.0.0/bin/
ExecStart=/opt/module/grafana-10.0.0/bin/grafana-server --homepath /opt/module/grafana-10.0.0 web
[Install]
WantedBy=multi-user.target

命令

sudo systemctl start grafana
sudo systemctl enable grafana
sudo systemctl status grafana

1.7.1 导入 grafana Dashboard

node-exporter-full_rev31.json
kafka-exporter-overview_rev5.json

1.7.2 grafana 监控 clickhouse集群

1.配置prometheus.yml文件添加如下内容,重启prometheus
在这里插入图片描述
2.配置clickhouse的conf.xml文件的prometheus字段,后重启clickhouse

在这里插入图片描述

  1. grafana配置clickhouse监控
    在这里插入图片描述
    在这里插入图片描述
    导入 监控clickhouse集群json配置文件
    clickhouse-metrics-on-settings_rev1.jsion

granfana的三个json文件可从官网获取

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【深入解析spring cloud gateway】02 网关路由断言

一、断言(Predicate)的意义 断言是路由配置的一部分&#xff0c;当断言条件满足&#xff0c;即执行Filter的逻辑&#xff0c;如下例所示 spring:cloud:gateway:routes:- id: add_request_header_routeuri: https://example.orgpredicates:- Path/red/{segment}filters:- AddR…

OCELOT: Overlapped Cell on Tissue Dataset for Histopathology

OCELOT dataset D { ( x s , y s c , x l , y l t , c x , c y ) i } i 1 N \mathcal{D} \left\{\left(\mathbf{x}_s, \mathbf{y}_s^c, \mathbf{x}_l, \mathbf{y}_l^t, c_x, c_y\right)_i\right\}_{i1}^{N} D{(xs​,ysc​,xl​,ylt​,cx​,cy​)i​}i1N​ x s ∈ R 1024 1…

修复中间件log4j漏洞方案(直接更换漏洞jar包)

说明&#xff1a; 后台服务里面的log4j漏洞我们已经全部升级处理了&#xff0c;但是一些中间件镜像包里的log4j漏洞需要单独处理 解决办法以ElasticSearch7.6.2为例&#xff1a; 方法&#xff1a; &#xff08;1&#xff09;找到容器里面有哪些旧的log4j依赖包 &#xff08;…

023-从零搭建微服务-推送服务(三)

原【短信服务】更名【推送服务】 写在最前 如果这个项目让你有所收获&#xff0c;记得 Star 关注哦&#xff0c;这对我是非常不错的鼓励与支持。 源码地址&#xff08;后端&#xff09;&#xff1a;https://gitee.com/csps/mingyue 源码地址&#xff08;前端&#xff09;&a…

Java后端开发面试题——企业场景篇

单点登录这块怎么实现的 单点登录的英文名叫做&#xff1a;Single Sign On&#xff08;简称SSO&#xff09;,只需要登录一次&#xff0c;就可以访问所有信任的应用系统 JWT解决单点登录 用户访问其他系统&#xff0c;会在网关判断token是否有效 如果token无效则会返回401&am…

图神经网络和分子表征:4. PAINN

如果说 SchNet 带来了【3D】的火种&#xff0c;DimeNet 燃起了【几何】的火苗&#xff0c;那么 PAINN 则以星火燎原之势跨入 【等变】时代。 在 上一节 中&#xff0c;我们提到&#xff0c; PAINN 在看到 DimeNet 取得的成就之后&#xff0c;从另一个角度解决了三体几何问题&a…

css3对文字标签不同宽,不同高使用瀑布流对齐显示

<div class"wrapper" style"padding: 0;"><span class"wf-item task-tags text-center" v-for"(item,index) in data.categorys" :key"index">{{ item }}</span> </div>/* 名称瀑布流显示 */ .wrap…

基于PyTorch的交通标志目标检测系统

一、开发环境 Windows 10PyCharm 2021.3.2Python 3.7PyTorch 1.7.0 二、制作交通标志数据集&#xff0c;如下图 三、配置好数据集的地址&#xff0c;然后开始训练 python train.py --data traffic_data.yaml --cfg traffic_yolov5s.yaml --weights pretrained/yolov5s.pt --e…

嵌入式基础知识-DMA

本篇来介绍DMA的一些基础知识。 1 DMA简介 DMA&#xff08;Direct Memory Access&#xff09;,中文名为直接内存访问&#xff0c;它是一些计算机总线架构提供的功能&#xff0c;能使数据从附加设备&#xff08;如磁盘驱动器&#xff09;直接发送到计算机主板的内存上。对应嵌…

(笔记七)利用opencv进行形态学操作

&#xff08;1&#xff09;程序清单 形态学操作是一种图像处理技术&#xff0c;它基于数学形态学理论&#xff0c;用于改变图像的形状和结构。它主要通过结构元素的腐蚀和膨胀操作来实现。 #!/usr/bin/env python # -*- coding:utf-8 -*- """ author: LIFEI t…

2023-9-4 最大公约数

题目链接&#xff1a;最大公约数 #include <iostream>using namespace std;int gcd(int a, int b) {return b ? gcd(b, a % b) : a; }int main() {int n;cin >> n;while(n--){int a, b;cin >> a >> b;cout << gcd(a, b) << endl;}return …

uniapp 处理 分页请求

我的需求是手机上一个动态滚动列表&#xff0c;下拉到底部时&#xff0c;触发分页数据请求 uniapp上处理分页解决方案 主要看你是如何写出滚动条的。我想到的目前有三种 &#xff08;1&#xff09;页面滚动&#xff1a;直接使用onReachBottom方法&#xff0c;可以监听到达底部…

【python爬虫】16.爬虫知识点总结复习

文章目录 前言爬虫总复习工具解析与提取&#xff08;一&#xff09;解析与提取&#xff08;二&#xff09;更厉害的请求存储更多的爬虫更强大的爬虫——框架给爬虫加上翅膀 爬虫进阶路线指引解析与提取 存储数据分析与可视化更多的爬虫更强大的爬虫——框架项目训练 反爬虫应对…

8K视频来了,8K 视频编辑的最低系统要求

当今 RED、Canon、Ikegami、Sony 等公司的 8K 摄像机以及 8K 电视&#xff0c;许多视频内容制作人和电影制作人正在认真考虑 8K 拍摄、编辑和后期处理&#xff0c;需要什么样的系统来处理如此海量的数据&#xff1f; 中央处理器&#xff08;CPU&#xff09; 首先&#xff0c;…

Redis 集群环境案例安装步骤

1. 3主3从redis集群配置 1.1 找3台真实虚拟机&#xff0c;各自新建 mkdir -p /myredis/cluster 1.2 新建6个独立的redis实例服务 1.2.1 本次案例设计说明(ip有变化) https://processon.com/diagraming/5fe6d76ce401fd549c8fe708 1.2.2 IP: 192.168.111.175端门6381/端口6…

基于Matlab实现多个图像压缩案例(附上源码+数据集)

图像压缩是一种将图像数据量减少的技术&#xff0c;以减少存储空间和传输带宽的需求。在本文中&#xff0c;我们将介绍如何使用Matlab实现图像压缩。 文章目录 简单案例源码数据集下载 简单案例 首先&#xff0c;我们需要了解图像压缩的两种主要方法&#xff1a;有损压缩和无…

深入理解联邦学习——联邦学习的分类:基础知识

分类目录&#xff1a;《深入理解联邦学习》总目录 在实际中&#xff0c;孤岛数据具有不同分布特点&#xff0c;根据这些特点&#xff0c;我们可以提出相对应的联邦学习方案。下面&#xff0c;我们将以孤岛数据的分布特点为依据对联邦学习进行分类。 考虑有多个数据拥有方&…

[国产MCU]-W801开发实例-MQTT客户端通信

MQTT客户端通信 文章目录 MQTT客户端通信1、MQTT介绍2、W801的MQTT客户端相关API介绍3、代码实现本文将详细介绍如何在W801中使用MQTT协议通信。 1、MQTT介绍 MQTT 被称为消息队列遥测传输协议。它是一种轻量级消息传递协议,可通过简单的通信机制帮助资源受限的网络客户端。 …

thinkphp6 入门(5)-- 模型是什么 怎么用

一、模型 MVC架构 之前开发一个功能&#xff0c;后端为在控制器&#xff08;C&#xff09;中写 php SQL&#xff0c;前端为在页面&#xff08;V&#xff09;中写html css js&#xff0c;这就形成了 VC 架构。 但是发现&#xff0c;相同的数据逻辑&#xff08;SQL&#xf…

会话跟踪技术学习笔记(Cookie+Session)+ HTTP学习笔记

一、会话跟踪技术&#xff08;CookieSession&#xff09; 1.1 预备知识 1. 会话&#xff1a;用户打开浏览器&#xff0c;访问web服务器的资源&#xff0c;会话建立&#xff0c;直到有一方断开连接&#xff0c;会话结束。在一次会话中可以包含多次请求和响应。 2. 会话跟踪&a…