Skip to content

Instantly share code, notes, and snippets.

Last active February 27, 2020 10:44
What would you like to do?
Lua script for redis_exporter
$ redis-cli -eval Redis_queue.lua
local result = {}
local cur = "0"
local pat = "*:queue"
local keys = nil
local done = false
local t ='TIME')
local r ="SCAN", cur, "MATCH", pat);
cur = r[1]
keys = r[2]
for _, v in ipairs(keys) do
local z ="ZCOUNT", v, '0', t[1])
table.insert(result, v)
table.insert(result, tostring(z))
if cur == "0" then
done = true
until done
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment