码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 快速上手prometheaus grafana 监控


    介绍

    prometheaus 一个定时输出指标数据的巡检组件?
    grafana 一个读取指标,可视化的提供了好看界面的组件?

    教程

    如何和springboot项目集成 【IT老齐153】超级实用!十分钟掌握Prometheus与Grafana监控SpringBoot应用_哔哩哔哩_bilibili

    1. 其中用到了docker来引入Prometheus与Grafana,我直接跟着底下教程 本机安装了,
    2. 学到了 springboot项目暴露监控指标的配置(配置文件放在最后)

    如何监控windows【小速通】速通windows平台部署prometheus+grafana监控自机_哔哩哔哩_bilibili

    四分钟的教程
    安装了个windows_exporter 可以让普罗米修斯监听windows的性能指标

    配置文件

    在这里插入图片描述

    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.
    
    alerting:
      alertmanagers:
        - static_configs:
            - targets:
              # - alertmanager:9093
    
    rule_files:
      # - "second_rules.yml"
    
    scrape_configs:
      - job_name: "prometheus"
        static_configs:
          - targets: ["localhost:9090"]
      #windows_exporter的配置
      - job_name: "windows_exporter"
        static_configs:
          - targets: ["localhost:9182"]
      #springboot项目的配置
      - job_name: "springboot_prometheus" 
        scrape_interval: 5s 
        metrics_path: '/actuator/prometheus' 
        static_configs: 
         - targets: ['localhost:81']
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    在这里插入图片描述在这里插入图片描述
    pom文件
    在这里插入图片描述

    #springboot yaml 配置
    spring:
      application:
        name: springboot-prometheus
    management:
      endpoints:
        web:
          exposure:
           include: "*"
      endpoint:
        health:
          show-details: always
        prometheus:
          enabled: true
      metrics:
        export:
          prometheus:
            enabled: true
    server:
        port: 81
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    实操截图

    1. springboot项目 actuator本身可以暴露出来的指标
      在这里插入图片描述

    2. 加了prometheus依赖后,可以更规范的返回
      在这里插入图片描述

    3. 上述这个项目的监控界面(用的dashboard id是 4701)
      在这里插入图片描述

    4. windows_exporter的监控界面(搜windows_exporter 第一个)
      在这里插入图片描述

    开源项目地址

    aiwandianao/prometheusGrafanaTinySpringbootDemo: 最基础的普罗米修斯和 Grafana 集成springboot 配置的项目,配有详尽的教程 (github.com)

  • 相关阅读:
    学习笔记4——JVM运行时数据区梳理
    论文阅读-ATLAS: A Sequence-based Learning Approach for Attack Investigation
    Linux下安装Redis
    webpack高级应用篇(十五):基于 Promise 的动态 Remote,让模块联邦版本化
    Qt项目移植到mac上一些问题汇总
    《向量数据库指南》——Milvus Cloud当初为什么选择向量数据库这个赛道呢?
    【笔试刷题训练】day_13
    10月20日,每日信息差
    【数据挖掘 | 关联性分析】万字长文详解关联性分析,详解Apriori算法为例,确定不来看看?
    JWT简介& JWT结构& JWT示例& 前端添加JWT令牌功能& 后端程序
  • 原文地址:https://blog.csdn.net/aiwandianao/article/details/138682491
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号