nginx 请求耗时监控

574 views
Skip to first unread message

linbo liao

unread,
Dec 11, 2015, 11:27:30 PM12/11/15
to openresty
Hi,

我们现在有些Nginx/Openresty 的服务,upstream到后端不同的逻辑模块上面。  如果想把请求耗时做统计监控(主要是access log中的请求耗时),并集成到graphite上面。 看了一下现有的方法

1. nginx商业版本的  ngx_http_status_module
2. 对日志做一些分析 ngxtop

1是商业版本,2要依赖日志。 请问一下,有没有其有没有其它什么好的方法。  Openresty这种场景的监控,一般用什么方法?

谢谢,
Linbo


DeJiang Zhu

unread,
Dec 12, 2015, 11:31:11 AM12/12/15
to open...@googlegroups.com
Hello,

首先,看你是想做个简单地单机版,还是想做集中的日志分析

单机版,就直接在 log_by_lua 里加入统计逻辑,利用 lua_shared_dict 做存储即可
集中分析,就在 log_by_lua 里将日志发送到集中存储,例如使用:lua-resty-logger-socket[1]
只是,这个分析过程还是得你来实现
或许,也有一些开源的实现,你可以找找,或者你来贡献一个,哈哈


 

谢谢,
Linbo


--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

linbo liao

unread,
Dec 12, 2015, 7:36:57 PM12/12/15
to openresty
谢谢。

需求很简单,就是类似一个命令行,返回一个K/V,比如 timestamp_url -> response_time

其实只需要把 ngx.var.upstream_response_time 做统计即可。

谢谢,
Linbo


在 2015年12月13日星期日 UTC+8上午12:31:11,doujiang写道:

高祥

unread,
Mar 6, 2017, 10:25:34 PM3/6/17
to openresty
我也有你这种类似的需求,比如统计某个资源的访问频率,目前的思路是从http请求报文中获取相关信息,然后将相关信息发送到statsd。但是不知道怎么实现这一套,不知道作者你怎么做的

在 2015年12月12日星期六 UTC+8下午12:27:30,linbo liao写道:
Reply all
Reply to author
Forward
0 new messages