mailru / graphite-nginx-module

An nginx module for collecting stats into Graphite
135 stars 34 forks source link

Example of graphite_param in documentation only sends 0 for me #22

Closed tareq-khandaker-ck-xx closed 6 years ago

tareq-khandaker-ck-xx commented 6 years ago

Hi,

I managed to get graphite_default_data and graphite_data working for me successfully (I can see line items being sent, and field values fluctuate based on request behaviour like as expected). When I try to set up custom parameter as shown in https://github.com/mailru/graphite-nginx-module#nginx-api-for-lua , I only see values of 0 being sent. I'm not using compiling in any additional modules into nginx besides this graphite-nginx-module and I don't see any errors in the logs, so I am really puzzled as to what might be wrong.

Thank you once again,

kirimedia commented 6 years ago

Show your nginx.conf, please And the output of nginx -V

coding-brigadier commented 6 years ago

I think the issue it seems that both our ngx-lua-module and nginx versions are above the given range.

From what I see ngx-lua is version 0.10.11 and nginx is 1.13.6.

Do you by chance know if support for those versions would be added soon? Or perhaps you have an alternative suggestion?

coding-brigadier commented 6 years ago

Also, to answer your question, the output of nginx -V is:

[root@941e0bcf9957 openresty]# nginx -V
nginx version: openresty/1.13.6.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2n  7 Dec 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-debug --with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2'
--add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61
--add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3
--add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.07
--add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.11 --add-module=../ngx_lua_upstream-0.07
--add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18
--add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15
--add-module=../rds-csv-nginx-module-0.08 --add-module=../ngx_stream_lua-0.0.3 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-pcre=/build/pcre-8.40 --with-openssl=/build/openssl-1.0.2n --with-zlib=/build/zlib-1.2.11
--add-module=/build/graphite-nginx-module-2.0 --with-stream --with-stream_ssl_module --with-http_ssl_module

The relevant part of nginx.conf for graphite is:

graphite_config prefix=[service_name] server=telegraf;

And then I made an endpoint like so:

    location /test {
        graphite_param name=resty.control.pass aggregate=sum interval=1m;
        content_by_lua_block {
           ngx.graphite("resty.control.pass", 1)
           ngx.say('hello')
        }
    }

In the end I got 0's:

[service_name],host=59696c210caf,instance=187b741bc47d,location=control,module=resty pass=0 1534526769000000000
kirimedia commented 6 years ago

I fixed it Try version 2.3

coding-brigadier commented 6 years ago

It works! I am getting the right values now:

[service_name],host=59696c210caf,instance=a487e449dbe3,location=control,module=resty pass=1 1534876993000000000