2018/05/17 22:35:44 [error] 54034-sharp0: *11 lua entry thread aborted: runtime error: /usr/local/nginx/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/LuaJIT/share/luajit-2.0.2/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 "/usr/local/LuaJIT/share/lua/5.1/ngx_metric/counter.lua"
no file "/usr/local/LuaJIT/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/LuaJIT/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/LuaJIT/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"
/usr/local/nginx/modules/ngx_metric_output.lua:3: 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: "127.0.0.1:9091"
2018/05/17 22:35:44 [error] 54034-sharp0: *11 failed to run log_by_lua*: /usr/local/nginx/modules/ngx_metric.lua:4: module "ngx_metric.util" not found:
no field package.preload["ngx_metric.util"]
no file "modules/ngx_metric/util.lua"
no file "./ngx_metric/util.lua"
no file "/usr/local/LuaJIT/share/luajit-2.0.2/ngx_metric/util.lua"
no file "/usr/local/share/lua/5.1/ngx_metric/util.lua"
no file "/usr/local/share/lua/5.1/ngx_metric/util/init.lua"
no file "/usr/local/LuaJIT/share/lua/5.1/ngx_metric/util.lua"
no file "/usr/local/LuaJIT/share/lua/5.1/ngx_metric/util/init.lua"
no file "./ngx_metric/util.so"
no file "/usr/local/lib/lua/5.1/ngx_metric/util.so"
no file "/usr/local/LuaJIT/lib/lua/5.1/ngx_metric/util.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/LuaJIT/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/nginx/modules/ngx_metric.lua:4: 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: "127.0.0.1:9091"
prompt that module "ngx_metric.counter" not found: can"t find it
but I do have this file
modules/
avg.lua
chunk_histogram.lua
counter.lua
histogram.lua
ngx_metric
avg.lua
chunk_histogram.lua
counter.lua
histogram.lua
ngx_metric.lua
util.lua
ngx_metric.lua
ngx_metric_output.lua
util.lua
partial code of cat / usr/local/nginx/modules/ngx_metric.lua
local util = require "ngx_metric.util"
local counter = require "ngx_metric.counter"
local chunkhisto = require "ngx_metric.chunk_histogram"
local _M = { _VERSION = "0.0.1" }
local mt = { __index = _M }
local function cut_uri(uri, section_len)
local uri_a = util.str_split(uri, "/")
local res = ""
for i = 1, math.min(section_len, -sharpuri_a) do
res = res .. "/" .. uri_a[i]
end
return res
end