0

kube-prometheus-stack我们在helm 图表中添加了两次 Loki 作为 grafana 的附加数据源,第一个是 type loki,第二个是 type prometheus,第二个是允许 grafana 从 loki 获得警报的唯一 hack:

grafana:
  ## Configure additional grafana datasources (passed through tpl)
  ## ref: http://docs.grafana.org/administration/provisioning/#datasources
  additionalDataSources:
    - name: Loki
      type: loki
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000
    - name: LokiAsPrometheus
      type: prometheus
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000

但是当我创建一个新的仪表板并选择LokiAsPromtheus作为数据源时,grafana http 响应会响应错误,就像配置错误一样。

4

1 回答 1

2

/loki资源作为 loki-as-prometheus url 的一部分至关重要,如下所示:

grafana:
  ## Configure additional grafana datasources (passed through tpl)
  ## ref: http://docs.grafana.org/administration/provisioning/#datasources
  additionalDataSources:
    - name: Loki
      type: loki
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100
      jsonData:
        maxLines: 1000
    - name: LokiAsPrometheus
      type: prometheus
      access: proxy
      url: http://loki.monitoring.svc.cluster.local:3100/loki
      jsonData:
        maxLines: 1000
于 2021-08-15T19:47:00.180 回答