快速上手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']

在这里插入图片描述在这里插入图片描述
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. springboot项目 actuator本身可以暴露出来的指标
    在这里插入图片描述

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

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

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

开源项目地址

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

相关推荐

  1. electron 快速上手学习

    2024-05-11 00:28:10       48 阅读
  2. 快速上手 Mac 电脑

    2024-05-11 00:28:10       65 阅读
  3. 快速上手vue指南

    2024-05-11 00:28:10       65 阅读
  4. 如何快速上手vue?

    2024-05-11 00:28:10       45 阅读
  5. 【flask快速上手(二)】

    2024-05-11 00:28:10       44 阅读
  6. 【flask快速上手(一)】

    2024-05-11 00:28:10       40 阅读
  7. 【php快速上手(五)】

    2024-05-11 00:28:10       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-11 00:28:10       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-11 00:28:10       106 阅读
  3. 在Django里面运行非项目文件

    2024-05-11 00:28:10       87 阅读
  4. Python语言-面向对象

    2024-05-11 00:28:10       96 阅读

热门阅读

  1. MySQL慢查询优化【二】

    2024-05-11 00:28:10       36 阅读
  2. Linux系统调用mmap

    2024-05-11 00:28:10       34 阅读
  3. 算法—四则运算

    2024-05-11 00:28:10       28 阅读
  4. c#读取bin文件

    2024-05-11 00:28:10       30 阅读
  5. GOOGLE翻译V3版

    2024-05-11 00:28:10       35 阅读
  6. L6201PSTR DMOS全桥驱动器

    2024-05-11 00:28:10       30 阅读
  7. Oracle 数据库非归档模式迁移数据文件存放位置

    2024-05-11 00:28:10       30 阅读
  8. 12.Netty入门案例

    2024-05-11 00:28:10       31 阅读