【问题标题】:Monitor KongApi using Prometheus使用 Prometheus 监控 KongApi
【发布时间】:2022-11-04 20:44:21
【问题描述】:

我正在使用 Prometheus 和 Grafana 通过在 Kong 上启用 Prometheus 插件来监控 KongAPI 网关。

我们的 Kong 架构使用一台专用服务器作为控制平面,另外两台服务器作为数据平面。

我需要在三台服务器上启用 Prometheus 插件吗?

服务器的指标是否不同,因此我需要配置 Prometheus 以从所有服务器收集指标?

非常感谢您的支持。

【问题讨论】:

  • 问题解决了吗?您是在混合模式还是分布式模式下部署?
  • 我正在使用混合模式。

标签: prometheus kong-plugin


【解决方案1】:

Do I need to enable Prometheus plugin on the three servers ?
由于您使用混合模式部署来部署 Kong,因此在控制平面上应用 Prometheus 插件(通过 Admin API 或 Kong Manager)。将插件应用到控制平面后,数据平面将被配置为公开 Prometheus 端点。

然后可以使用状态 API 抓取指标,假设您在两个数据平面上都禁用了管理 API。

# setting status listen in kong.conf to expose port 8100 
(it can be configured as https endpoint the same way as proxy_listen)
status_listen = 0.0.0.0:8100

设置此公开端口 8100,Prometheus 将在 :8100/metrics 公开指标

普罗米修斯配置示例:

- job_name: kong
  static_configs:
    - targets:
      - <CP-ip>:8100
      - <DP1-ip>:8100
      - <DP2-ip>:8100

Are Metrics of the servers different so that I need to configure Prometheus to collect the metrics from all servers ?
指标将“有些”不同(例如,仅在 DP 上的代理指标),但这些指标将包含实例 IP:
例如:kong_memory_lua_shared_dict_bytes{instance="IP:8100", job="kong", kong_subsystem="http", shared_dict="kong"}

此外,Kong 的 Grafana 仪表板已经考虑了多个实例,因此如果您使用上面的配置来抓取指标,Grafana 将在图中绘制 3 条线,每条线代表一个实例(1CP + 2 DPs)

【讨论】:

    猜你喜欢
    • 2018-05-22
    • 2019-10-23
    • 1970-01-01
    • 2020-09-08
    • 2020-05-27
    • 1970-01-01
    • 1970-01-01
    • 2018-08-01
    • 2023-03-11
    相关资源
    最近更新 更多