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

centos7下安装promethus及grafana

1、下载,如下地址下载prometheus和相应的exporter
https://github.com/prometheus/prometheus/releases
本次下载的是2.55.1
https://github.com/prometheus/prometheus/releases/download/v2.55.1/prometheus-2.55.1.linux-amd64.tar.gz
2、node_exporter
https://github.com/prometheus/node_exporter/releases
版本为1.8.2
https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
3、解压并复制文件到/usr/bin
tar zxvf prometheus-2.55.1.linux-amd64.tar.gz
tar zxvf node_exporter-1.8.2.linux-amd64.tar.gz

prometheus.yaml 文件内容:其实是模板

# 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: ["localhost:9090"]

4、设置服务
nano /usr/lib/systemd/system/prometheus.service

[Unit]
  Description=https://prometheus.io
  
  [Service]
  Restart=on-failure
  ExecStart=/usr/bin/prometheus --config.file=/app/prometheus/prometheus.yml --web.listen-address=:9090

  [Install]                      
  WantedBy=multi-user.target

systemctl status prometheus
systemctl start prometheus
systemctl enable prometheus

5、启动后
起来后使用 节点名或ip:9090访问

6、node_exporter启动

直接启动

./node_exporter &

启动后会监听9100端口

添加为服务方式启动

nano /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
After=network.target 

[Service]
ExecStart=/usr/bin/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动node_exporter

systemctl daemon-reload
systemctl start node_exporter
7、安装grafana

docker run -d -p 3000:3000 --name grafana swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/rancher/mirrored-grafana-grafana:9.1.5

8、下载grfana的promethus模板并导入
访问地址 节点ip:3000 默认admin/admin
promethus的grafana模板
https://grafana.com/grafana/dashboards/8919


http://www.kler.cn/a/422042.html

相关文章:

  • 【Linux篇】权限管理 - 用户与组权限详解
  • POI和easyExcel详解
  • Python的秘密基地--[章节2]Python核心数据结构
  • [C++设计模式] 为什么需要设计模式?
  • 【C语言】递归的内存占用过程
  • 嵌入式蓝桥杯学习1 点亮LED
  • flutter 报错 error: unable to find git in your path.
  • MongoDB注入攻击测试与防御技术深度解析
  • 若依前端问题
  • redis针对string的命令及应用场景
  • API 数据接口使用与安全指南
  • vitess使用记录:vtctldclient,设置分表规则
  • Postgres 如何使事务原子化?
  • [每周一更]-(第125期):模拟面试|NoSQL面试思路解析
  • 备赛蓝桥杯--算法题目(2)
  • 基于Matlab地形和环境因素的森林火灾蔓延模拟与可视化研究
  • Windows系统搭建Docker
  • 040集——CAD中放烟花(CAD—C#二次开发入门)
  • qt6 oob
  • 微服务即时通讯系统的实现(服务端)----(3)
  • 基于Python 哔哩哔哩网站热门视频数据采集与可视化分析设计与实现,有聚类有网络语义研究
  • 【数据集】细胞数据集:肿瘤-胎儿重编程的内皮细胞驱动肝细胞癌中的免疫抑制性巨噬细胞(Sharma等人)
  • helm部署golang服务
  • numpy 计算两组向量是否相等,以及在一定误差内相等
  • QT - (qrc->binary)
  • 人工智能学习框架:构建AI应用的基石