skipper prometheus 监控

时间:2021-09-09 11:10:55

skipper 是支持prometheus监控的,只是没有启用,需要添加参数 -enable-prometheus-metrics
测试使用的是一个简单nginx web ,同时使用docker-compose 运行

环境准备

  • docker-compose 文件
version: "3"
services:
skipper:
image: dalongrong/skipper:latest
ports:
- "9090:9090"
- "9911:9911"
volumes:
- "./router.eskip:/router.eskip"
command: skipper -enable-ratelimits -enable-prometheus-metrics -routes-file router.eskip
g:
image: grafana/grafana
ports:
- "3000:3000"
web:
image: nginx
ports:
- "8099:80"
p:
image: prom/prometheus
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- "9091:9090"
  • prometheus 监控静态配置
    prometheus.yml
scrape_configs:
- job_name: skipper
metrics_path: /metrics
static_configs:
- targets: ['skipper:9911']
  • skipper router 配置
    很简单就是启用了cors
all: * -> corsOrigin()-> "http://web";

启动&&测试

  • 启动
docker-compose up -d
  • 测试
    web 请求界面
    skipper prometheus 监控
    metrics
    skipper prometheus 监控
    skipper prometheus 监控
    grafana 界面
    skipper prometheus 监控

说明

grafana 的配置很简单,就没有写,skipper 的功能还是很强大的,从监控界面上我们也可以快速的参数请求的信息。

参考资料

https://opensource.zalando.com/skipper/operation/operation/
https://github.com/rongfengliang/skipper-prometheus-docker-compose