Git Product home page Git Product logo

falcon-ngx_metric's People

Contributors

feiyuw avatar guycheung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

falcon-ngx_metric's Issues

字符错误

客户端打这种请求: { "timestamp": "2018-04-18T01:02:34+08:00", "host": "xx.xx.xx.xxx", "user": "-", "request": "\x16\x03\x01\x00\xDA\x01\x00\x00\xD6\x03\x03\xAD\x03\x99&*{\xAB\xAB\x8C\x1DS\x82\xCF\xA4y\xCF\x84\xB4\xEB\xAF}\x93S,u\xD4\xB5\x1E\x10\xB2\xE5;\x00\x00(\xC0,\xC0+\xC0$\xC0#\xC0", "clientip": "xx.xxx.xx.xxx", "size": 166, "responsetime": 5.000, "upstreamtime": "-", "upstreamhost": "-", "upstreamstatus": "-", "http_host": "_", "url": "-", "referrer": "-", "x_forwarded_for": "-", "agent": "-", "status": "400"}

error日志会有这种错误
2018/04/18 10:02:30 [error] 124908#124908: 4252054 failed to run log_by_lua: /usr/local/nginx/modules/ngx_metric/util.lua:49: bad argument #1 to 'gmatch' (string expected, got nil)
stack traceback:
[C]: in function 'gmatch'
/usr/local/nginx/modules/ngx_metric/util.lua:49: in function 'str_split'
.../local/nginx/modules/ngx_metric/ngx_metric.lua:12: in function 'cut_uri'
.../local/nginx/modules/ngx_metric/ngx_metric.lua:24: in function 'new'
/usr/local/nginx/modules/ngx_metric.lua:16: in function </usr/local/nginx/modules/ngx_metric.lua:1> while logging request, client: xxx.xx.xx.xxx, server: _, request: "µ±Z֧68Ӝe^,>c5T~쀍"

执行脚本有报错

Traceback (most recent call last):
File "nginx_collect.py", line 450, in collect
append_datapoint(datapoints, Render.render(la))
File "nginx_collect.py", line 70, in render
c = renders[la[0]]
KeyError: ''

values error?

in falcon-ngx_metric/lua/ngx_metric/histogram.lua 24 line
if we should use **self.**values = util.str_split(values, ",") instead?

lua文件部署后启动nginx报错是什么问题

[root@izuf68l0q1ggeg7q97i1o5z falcon-ngx_metric]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@izuf68l0q1ggeg7q97i1o5z falcon-ngx_metric]# systemctl status nginx.service
Jan 13 15:16:27 izuf68l0q1ggeg7q97i1o5z nginx[2388]: nginx: [emerg] unknown directive "lua_package_path" in /etc/nginx/conf.d/ngx_metric.conf:1

nginx的lua统计有延时

在dashboard中经常出现断点,重新恢复的请求量差不多是“失联”这段时间的请求量,请问该如何排查,机器openfalcon排查没问题,agent也没问题
image

log_by_lua调用util.lua方法报错,这是咋回事

2016/12/08 14:46:13 [error] 25707#0: *633 lua entry thread aborted: runtime error: modules/ngx_metric/util.lua:9: attempt to call method 'get_keys' (a nil value)
stack traceback:
coroutine 0:
modules/ngx_metric/util.lua: in function 'dict_get_keys'
modules/ngx_metric/counter.lua:18: in function 'get_snapshot'
/usr/local/nginx/modules/ngx_metric_output.lua:18: in function </usr/local/nginx/modules/ngx_metric_output.lua:1>, client: 127.0.0.1, server: 127.0.0.1, request: "GET /monitor/basic_status HTTP/1.1", host: "localhost:9091"
2016/12/08 14:46:13 [error] 25707#0: 633 failed to run log_by_lua: modules/ngx_metric/util.lua:35: attempt to call method 'safe_add' (a nil value)
stack traceback:
modules/ngx_metric/util.lua:35: in function 'dict_safe_incr'
modules/ngx_metric/counter.lua:14: in function 'add'
modules/ngx_metric/ngx_metric.lua:58: in function 'err_count'
modules/ngx_metric/ngx_metric.lua:92: in function 'record'
/usr/local/nginx/modules/ngx_metric.lua:17: in function </usr/local/nginx/modules/ngx_metric.lua:1> while logging request, client: 127.0.0.1, server: 127.0.0.1, request: "GET /monitor/basic_status HTTP/1.1", host: "localhost:9091"

疑问&建议,希望插件越来越好!

你好:
鉴于每个人的nginx启动方式和位置不同,可以考虑提示下部分代码内的lua文件路径地址根据需要修改,目前ngx_metric.conf 文件里调用的文件路径是相对的,会报错找不到文件。
别问我怎么想到的。嘿嘿。丢人。

emergency request

一个负载均衡下的两个相同的nginx,运行着两个falcon-ngx_metric,相同的api请求数目统计push上去会相加么?

nginx报lua错误 21186#0: *8304 lua entry thread aborted: runtime error

nginx版本:1.8.0
nginx编译参数:

nginx version: nginx/1.8.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) 
built with OpenSSL 1.0.2e 3 Dec 2015
TLS SNI support enabled
configure arguments: --prefix=/usr/local/services/nginx-1.8.0 --with-pcre=/data/tmp/pcre-8.37 --with-zlib=/data/tmp/zlib-1.2.8 --with-openssl=/data/tmp/openssl-1.0.2e --with-http_gzip_static_module --with-http_ssl_module --add-module=/data/tmp/ngx_http_qrcode_module --with-ld-opt=-Wl,-rpath,/usr/local/lib --add-module=/data/tmp/ngx_http_barcode --add-module=/usr/local/src/lua-nginx-module-0.10.10/ --add-module=/usr/local/src/ngx_devel_kit-0.3.0/ --with-http_stub_status_module

lua版本:
ll /usr/local/bin/luajit
lrwxrwxrwx 1 root root 12 Nov 14 10:43 /usr/local/bin/luajit -> luajit-2.0.5

nginx_metric配置:

lua_package_path "modules/?.lua;;";
lua_shared_dict result_dict 128M;
log_by_lua_file modules/ngx_metric.lua;

server {

    listen          127.0.0.1:9091;
    server_name     127.0.0.1;
    access_log logs/ngx_metric_for_falcon.access.log;
    error_log logs/ngx_metric_for_falcon.error.log;

    location /monitor/basic_status {
        content_by_lua_file modules/ngx_metric_output.lua;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }   

    location /monitor/nginx_status {
        stub_status on; 
        access_log off ;
        allow 127.0.0.1;
        deny all;
    }   
}

配置好nginx,请求:
curl http://127.0.0.1:9091/monitor/basic_status
返回500错误

nginx_metric.error.log:

2018/11/14 17:11:31 [error] 21186#0: *8304 lua entry thread aborted: runtime error: ...local/services/nginx-1.8.0/modules/ngx_metric_output.lua:3: module 'ngx_metric.counter' not found:
	no field package.preload['ngx_metric.counter']
	no file 'modules/ngx_metric/counter.lua'
	no file './ngx_metric/counter.lua'
	no file '/usr/local/share/luajit-2.0.5/ngx_metric/counter.lua'
	no file '/usr/local/share/lua/5.1/ngx_metric/counter.lua'
	no file '/usr/local/share/lua/5.1/ngx_metric/counter/init.lua'
	no file './ngx_metric/counter.so'
	no file '/usr/local/lib/lua/5.1/ngx_metric/counter.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file './ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
coroutine 0:
	[C]: in function 'require'
	...local/services/nginx-1.8.0/modules/ngx_metric_output.lua:3: in function <...local/services/nginx-1.8.0/modules/ngx_metric_output.lua:1>, client: 127.0.0.1, server: 127.0.0.1, request: "GET /monitor/basic_status HTTP/1.1", host: "127.0.0.1:9091"
2018/11/14 17:11:31 [error] 21186#0: *8304 failed to run log_by_lua*: /usr/local/services/nginx-1.8.0/modules/ngx_metric.lua:4: module 'ngx_metric.ngx_metric' not found:
	no field package.preload['ngx_metric.ngx_metric']
	no file 'modules/ngx_metric/ngx_metric.lua'
	no file './ngx_metric/ngx_metric.lua'
	no file '/usr/local/share/luajit-2.0.5/ngx_metric/ngx_metric.lua'
	no file '/usr/local/share/lua/5.1/ngx_metric/ngx_metric.lua'
	no file '/usr/local/share/lua/5.1/ngx_metric/ngx_metric/init.lua'
	no file './ngx_metric/ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/ngx_metric/ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file './ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/ngx_metric.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[C]: in function 'require'
	/usr/local/services/nginx-1.8.0/modules/ngx_metric.lua:4: in function </usr/local/services/nginx-1.8.0/modules/ngx_metric.lua:1> while logging request, client: 127.0.0.1, server: 127.0.0.1, request: "GET /monitor/basic_status HTTP/1.1", host: "127.0.0.1:9091"

好赞!!不知道后续有没有对server层面和整机层面的统计?

看了下代码,写得很赞,学习了很多,特别是对sample抽样部分。
有两个问题请教下:

1,目前这个统计是针对uri(location)层面的,我打算将其扩展到可以统计server层和http层的,不知道有啥难度没?(估计应该是没啥难度的,代码的耦合度都很低,很方便扩展)

2,另外,是否可以按照每个upstream的名字统计下每个upstream的counter和time? 这样更具体详细。
(粗略看了下,目前只是按照uri对相应的upstream进行了time的统计,获取upstream的名字会是难点么?)

除了query_count和lantency的信息,其他的信息都获取不到

按照教程配置好了,但是

curl http://127.0.0.1:9091/monitor/basic_status

之后,只能得到query_count 和 lantency信息,如下所示

query_count|127.0.0.1|/monitor/basic_status|3
latency_99th|127.0.0.1|/monitor/basic_status|0.002
latency_95th|127.0.0.1|/monitor/basic_status|0.002
latency_50th|127.0.0.1|/monitor/basic_status|0.001
latency_75th|127.0.0.1|/monitor/basic_status|0.002

请问是什么问题 🙏

python脚本运行报错

Traceback (most recent call last):
File "nginx_collect.py", line 450, in collect
append_datapoint(datapoints, Render.render(la))
File "nginx_collect.py", line 70, in render
c = renders[la[0]]
KeyError: ''

脚本执行错误

我执行脚本以后就报下面的错,请问是什么导致的呢,谢谢!
[root@fqy-nginx-4 falcon-ngx_metric]# python nginx_collect.py --format=falcon
Traceback (most recent call last):
File "nginx_collect.py", line 450, in collect
append_datapoint(datapoints, Render.render(la))
File "nginx_collect.py", line 70, in render
c = renders[la[0]]
KeyError: ''

采集上来的URI过多,如何能够过滤出自己想要的

/civil/api/civil.user.UserLogin
/civil/api/civil.device.GetDeviceListEx
/civil/api/civil.device.SetAlarmPlanConfig
。。。
upstream_web_civil 这个回源接口的req_total_count、 timeout_ total_count、 error_ total_count、 latency_ total_avg

比如我只想要过滤出如上这样的几个接口,其他都屏蔽掉, 有什么方法么?

疑问

/monitor/nginx_status, 您在nginx.conf有配置这个,但我发现代码中并没有通过这个接口来获取连接数等,这个配置是不是可以去掉呢?

请教关于数据收集的问题

大神,请问ngx_metric收集了当前nginx所有的访问吗? /monitor/basic_status这个链接的请求,是否记录了所有?

使用疑问

使用过程中,我按照 README.md 的方法,部署好了 lua 模块。但遇到些问题,我的使用流程大致如下:

  1. 通过如下 bash 脚本来模拟访问 lua 模块监控的站点
#!/bin/bash

while [ 1 == 1 ]; do
	curl http://localhost:9091/ >/dev/null 2>&1
	sleep 1s
	curl http://localhost:9091/monitor/basic_status >/dev/null 2>&1
	curl http://localhost:9091/monitor/nginx_status >/dev/null 2>&1
	curl http://localhost:9091/hello >/dev/null 2>&1
	sleep 1s
done
  1. 通过如下 bash 脚本来 push 搜集到的数据到 agent 接口(http://127.0.0.1:1988/v1/push
#!/bin/bash

while [ 1 == 1 ]; do
        python nginx_collect.py --service=`hostname` --format=falcon --falcon-addr=http://127.0.0.1:1988/v1/push >/dev/null 2>&1
        sleep 2s
done
  1. 采集一段时间后,在 falcon 的 dashboard 浏览监控数据:

我的几点疑问:

  1. 由上述 1 脚本可以看出,每分钟访问 /monitor/basic_status/hello/monitor/nginx_status 接口至少有几十次,但在 dashboard 都显示每分钟 只1次?这明显跟 README.md 上截图的监控效果不一样。
  2. 我的使用方式是否存在误区?如果有,请指正。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.