$ redis-cli -eval Redis_queue.lua
Last active
February 27, 2020 10:44
-
-
Save hostmaster/c8fb83f6f9073e207a393106984d304f to your computer and use it in GitHub Desktop.
Lua script for redis_exporter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local result = {} | |
local cur = "0" | |
local pat = "*:queue" | |
local keys = nil | |
local done = false | |
local t = redis.call('TIME') | |
repeat | |
local r = redis.call("SCAN", cur, "MATCH", pat); | |
cur = r[1] | |
keys = r[2] | |
for _, v in ipairs(keys) do | |
local z = redis.call("ZCOUNT", v, '0', t[1]) | |
table.insert(result, v) | |
table.insert(result, tostring(z)) | |
end | |
if cur == "0" then | |
done = true | |
end | |
until done | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment