kong插件Prometheus+grafana图形化展示


1. 准备工作

部署 1.Promethues2.Grafana

3. 为kong添加 prometheus插件

curl -i -X POST --url http://localhost:8001/plugins --data "name=prometheus"

4. 打开kong的metrics支持

http://localhost:8001/metrics 端点上的Admin API提供了度量标准。需要配置权限使promtheus server能够从这个api访问并取数据

4. 配置prometheus.yml添加kong提供的数据信息

$PROMETHEUS_HOME/prometheus.yml

找到 - targets: ['localhost:9090'] 这一行,添加 Kong 管理节点,添加后如下:

- targets: ['localhost:9090','localhost:8001'] 

重启prometheus服务:

systemctl restart prometheus

验证prometheus是否能正常获取kong api数据, 访问ip:9090,输入kong关键字:

5. 在 Grafana 管理界面添加数据源

“Configuration” => “Add data source” => “Prometheus” => “select”
配置URL:http://localhost:9090

6. 添加官方 Dashboard

  1. 登录 Grafana 后,点击左边的 “+” => “Create” => “Import”。
  2. 输入 7424 ,7424 是 Kong 官方提供的与 Prometheus 插件配套的 Dashboard。
  3. 完成,调用 Kong 网关接口即可查看数据。

 
[sleepy↓]

posted @ 2020-03-15 10:33  孙红雷哔哔  阅读(3108)  评论(4编辑  收藏  举报