Prometheus运算符-简单的Flask应用程序中的指标未显示

时间:2020-03-28 11:07:14

标签: python flask prometheus prometheus-operator

全部结束 我对通过Prometheus Operator监视Flask的“ Hello world”应用程序的基本设置有问题。如您所能,服务监视器正被Prometheus捕获,就像它出现在UI中一样,但指标没有显示:(我不知道为什么。权限吗?

我只是将文件添加到 service_monitor_flask.yaml flask_service.yaml values.yaml (除serviceMonitorSelector以外的默认设置)和使用的命令:helm install prometheus stable/prometheus-operator --namespace monitoring -f values.yaml

enter image description here

service_monitor_flask.yaml

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: hello-flask-service-monitor
  labels:
    app: hello-flask-service-monitor
spec:
  selector:
    matchLabels:
      service: hello-flask-metrics
  namespaceSelector:
     matchNames:
        - hello-flask
#     any: true
  endpoints:
  - port: http-metrics
    interval: 15s
#    scheme: http

flask_service.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    service: hello-flask-metrics
  name: hello-flask
spec:
  ports:
  - name: http-metrics
    protocol: TCP
    port: 5000
    targetPort: metrics
  selector:
    app: hello-flask

values.yaml

serviceMonitorSelector: {"matchLabels":{
  "app": "hello-flask-service-monitor"
}}

serviceMonitorNamespaceSelector: {}

0 个答案:

没有答案