我试图在Kubernetes上使用Prometheus来监视Spring应用程序。Promethus使用Helm不方便,我使用Spring执行器进行健康检查、审计、计量收集和监测。
执行器给出了应用的细节。例如
http://**IP:Port**/actuator/health返回值低于输出
{"status":"UP"}.我使用下面的配置文件添加promethus中的应用程序终结点。
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,没有端点被分配。所以这里会有什么问题。真的很感谢你的帮助。


谢谢。
发布于 2019-05-29 09:59:16
在弹簧启动执行器文档中,更具体地说是端点部分。可以看到,除了禁用的Shutdown之外,Endpoint是默认的,但只公开了health和info。
这可以检查这里。
您需要手动公开所需的端点。
您想要使用的终结点,即Prometheus,对于JMX不可用,对于Web是禁用的。
若要更改公开的端点,请使用以下特定于技术的
include和exclude属性: 属性\默认management.endpoints.jmx.exposure.exclude|management.endpoints.jmx.exposure.include\x{e76f}*management.endpoints.web.exposure.exclude|management.endpoints.web.exposure.includex-info, healthinclude属性列出了公开的端点的ID。exclude属性列出了不应公开的端点的ID。exclude属性优先于include属性。可以使用端点ID列表配置include和exclude属性。 例如,若要停止在JMX上公开所有端点并仅公开health和info端点,请使用以下属性:management.endpoints.jmx.exposure.include=health,info*可用于选择所有端点。例如,要在HTTP上公开除env和beans端点之外的所有内容,请使用以下属性:management.endpoints.web.exposure.include=*management.endpoints.web.exposure.exclude=env,beans
https://stackoverflow.com/questions/56339565
复制相似问题