openresty监控
基于prometheus监控
示例的详细配置请参考 链接
使用开源的项目nginx-lua-prometheus监控openresty状态
配置prometheus监控openresty步骤如下:
编译
openresty,注意:编译openresty需要添加参数--with-http_stub_status_module,否则nginx-lua-prometheus插件无法读取ngx.var.connections_reading变量导致不能正常运行。配置
openresty metrics端点,用于给prometheus收集监控信息- 参考 nginx-lua-prometheus
README.md说明文档配置openresty - 配置成功后访问
http://localhost:9145/metrics查看openresty metrics端点prometheus数据
- 参考 nginx-lua-prometheus
配置
prometheus收集openresty metrics数据prometheus.yml配置如下:yamlscrape_configs: - job_name: "prometheus" static_configs: - targets: ["prometheus:9090"] # openresty metrics端点配置 - job_name: 'openresty' static_configs: - targets: ['openresty:9145']启动
prometheus,登录grafana http://localhost:3000,手动导入模板ID 10223使用
jmeter运行jmeter.jmx创建测试数据