首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Kubernetes上使用Prometheus监视Spring应用程序,而不是设置端点

在Kubernetes上使用Prometheus监视Spring应用程序,而不是设置端点
EN

Stack Overflow用户
提问于 2019-05-28 09:55:29
回答 1查看 1.3K关注 0票数 1

我试图在Kubernetes上使用Prometheus来监视Spring应用程序。Promethus使用Helm不方便,我使用Spring执行器进行健康检查、审计、计量收集和监测。

执行器给出了应用的细节。例如

http://**IP:Port**/actuator/health返回值低于输出

代码语言:javascript
复制
{"status":"UP"}.

我使用下面的配置文件添加promethus中的应用程序终结点。

代码语言:javascript
复制
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

因此,我的问题是,甚至服务被添加到prometheus,没有端点被分配。所以这里会有什么问题。真的很感谢你的帮助。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2019-05-29 09:59:16

弹簧启动执行器文档中,更具体地说是端点部分。可以看到,除了禁用的Shutdown之外,Endpoint是默认的,但只公开了healthinfo

这可以检查这里

您需要手动公开所需的端点。

您想要使用的终结点,即Prometheus,对于JMX不可用,对于Web是禁用的。

若要更改公开的端点,请使用以下特定于技术的includeexclude属性: 属性\默认 management.endpoints.jmx.exposure.exclude | management.endpoints.jmx.exposure.include \x{e76f}* management.endpoints.web.exposure.exclude | management.endpoints.web.exposure.include x- info, health include属性列出了公开的端点的ID。exclude属性列出了不应公开的端点的ID。exclude属性优先于include属性。可以使用端点ID列表配置includeexclude属性。 例如,若要停止在JMX上公开所有端点并仅公开healthinfo端点,请使用以下属性: management.endpoints.jmx.exposure.include=health,info *可用于选择所有端点。例如,要在HTTP上公开除envbeans端点之外的所有内容,请使用以下属性: management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=env,beans

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56339565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档