kubernetes - Loki 设置为 Prometheus 数据源以便对日志计数发出警报,配置错误,出现 404 错误
问题描述
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 响应会响应错误,就像配置错误一样。
解决方案
将/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
推荐阅读
- firebase - 如何在 Flutter 和 Firebase 中添加打卡和打卡功能?
- asp.net-core - 如何将 Blazor Webassembly 的 Google reCAPTCHA v2 与 ASP.NET Core 集成?
- php - 拉拉维尔 | 为什么雄辩的模型中缺少 id?
- c# - XML 到 CSV 的转换,如 MS Excel
- spring - 如何在具有相同代码库的特定服务器中运行计划任务
- python - 如何向concurrent.futures ThreadPool executor提交任务并立即返回回复
- java - 如何从 java 程序本身更改域的 IP 地址?
- python - 平均观看 Facebook 分钟数指标
- jolt - 带有数组值的 Jolt Transformation Spec
- c# - Webapis 中的静态类