当前位置: 首页 > 知识库问答 >
问题:

在Kubernetes上使用Prometheus监视Spring Boot应用程序,而不设置结束点

慕河
2023-03-14

我正在尝试使用Prometheus在Kubernetes上监视Spring Boot应用程序。Promethus正在使用Helm,而我正在使用Spring Boot执行器进行健康检查、审计、度量收集和监控。

致动器给出了应用的详细说明。例如:

http://**ip:port**/actuator/healt在输出下方返回

{"status":"UP"}.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: scp-service-creator
  namespace: sc678
  labels:
    app: scp-service-creator
    release: prometheus-operator
spec:
  selector:
    matchLabels:
      app: scp-service-creator
  endpoints:
  - port: api
    path: "/actuator/prometheus"
    scheme: http
    interval: 10s
    honorLabels: true

共有1个答案

益富
2023-03-14

从Spring Boot Actuctor文档中,更具体的是endpoint部分。可以读到,除了shutdown被禁用外,默认启用了endpoint,但只公开了healthinfo

这个可以在这里查。

您需要手动公开所需的endpoint。

management.endpoints.web.exposure.exclude

Management.Endpoints.Web.Exposure.Include信息,健康

include属性列出公开的endpoint的ID。exclude属性列出了不应公开的endpoint的ID。exclude属性优先于include属性。可以使用endpointID列表配置includeexclude属性。

management.endpoints.web.exposure.include=*management.endpoints.web.exposure.exclude=env,beans

 类似资料:
  • 我在本地的kubernetes集群中部署了spring boot支持的微服务。微服务正在使用micrometer和prometheus registry,但由于我们公司的政策,执行器可在另一个端口上使用: 8080,用于“业务”http请求 执行器的8081/管理。因此,我可以访问并查看在本地运行进程(不使用kubernetes)时的度量。 现在,我是Prometheus的初学者,对kuberne

  • 我是kubernetes的新手,需要在openshift平台上使用k8s confimap将springboot应用程序的属性文件外部化。我已将属性文件保存在git repo中,作为“greeter.message=Spring Bootmyapplication.properties已在库伯内特斯上挂载为卷!”并使用“oc create confimap myconfig--from-file=

  • 我已经使用和Jetty在服务器(在8091)中部署了一个Java应用程序。 我需要用普罗米修斯和格拉法纳监控那个应用程序。 config.yaml 我在通常的部署中使用的部署命令:(在这个目录中,存在Jetty) 它很好用..

  • 我们使用 Giantswarm 开源的 kubernetes-promethues 来监控 kubernetes 集群,所有的 YAML 文件可以在 ../manifests/prometheus 目录下找到。 需要用到的镜像有: harbor-001.jimmysong.io/library/prometheus-alertmanager:v0.7.1 harbor-001.jimmysong.

  • 主要内容:1.Micrometer简介,2.SpringBoot Actuator,3.Prometheus,4.自定义Metric,5.总结1.Micrometer简介 Micrometer 为 Java 平台上的性能数据收集提供了一个通用的 API,应用程序只需要使用 Micrometer 的通用 API 来收集性能指标即可。Micrometer 会负责完成与不同监控系统的适配工作。这就使得切换监控系统变得很容易。Micrometer 还支持推送数据到多个不同的监控系统。Micrometer

  • 我的问题是这样的--假设我有一个war文件,叫做My-APP-123.war。我想把它部署在Tomcat服务器(9.0.x)上,让它自动解包。 然后可以通过http://localhost:8080/my-app-123访问该应用程序 有没有一种方法,不重命名war文件,就可以从http://localhost:8080/my-app访问应用程序? 在此之前,我将说,我意识到最简单的解决方案是只命