docker 部署 prometheus + Grafana +

prometheus安装

1.拉镜像

docker pull prom/prometheus:v2.43.0

2.创建配置文件

mkdir /opt/prometheus/data

cd /opt/prometheus/

vi prometheus.yml

3.使用root用户启动

docker run --name prometheus -d -p 9090:9090 -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /opt/prometheus:/prometheus --user=root prom/prometheus:v2.43.0

4.查询启动情况

docker logs --tail 100 -f prometheus

Grafana安装

1.拉镜像

docker pull grafana/grafana-enterprise:8.5.22

2.启动

docker run -d --name=grafana -p 3000:3000 grafana/grafana-enterprise:8.5.22

3.配置数据源、监控

xxxx

spring boot项目:

复制代码
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
复制代码
management.endpoint.shutdown.enabled=false
management.endpoint.metrics.enabled=true
management.metrics.tags.application=${spring.application.name}
management.metrics.export.prometheus.enabled=true
相关推荐
weixin-a1530030831612 分钟前
【playwright篇】教程(十七)[html元素知识]
java·前端·html
DCTANT35 分钟前
【原创】国产化适配-全量迁移MySQL数据到OpenGauss数据库
java·数据库·spring boot·mysql·opengauss
Touper.1 小时前
SpringBoot -- 自动配置原理
java·spring boot·后端
黄雪超1 小时前
JVM——函数式语法糖:如何使用Function、Stream来编写函数式程序?
java·开发语言·jvm
ThetaarSofVenice1 小时前
对象的finalization机制Test
java·开发语言·jvm
思则变1 小时前
[Pytest] [Part 2]增加 log功能
开发语言·python·pytest
lijingguang1 小时前
在C#中根据URL下载文件并保存到本地,可以使用以下方法(推荐使用现代异步方式)
开发语言·c#
¥-oriented2 小时前
【C#中路径相关的概念】
开发语言·c#
CoderCodingNo2 小时前
【GESP】C++四级考试大纲知识点梳理, (7) 排序算法基本概念
开发语言·c++·排序算法
恋猫de小郭2 小时前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin