Hi everyone
From time to time hub queues gets issues and start stacking messages. I'm trying to build a script for identifying these issues and create alerts and QOS data. The script below is partly a copy from another tread and is quite static only considering one queue. I would like to run through any queue and do this by a function instead of a fixed script.
I have the object q.name containing all the queues for any hub, but I struggle to rewrite this static query to a generic supervision.
I guess many other have done similar stuff. Any suggestions?
function gethubs()
hubs, rc = nimbus.request("hub", "gethubs")
if (rc == 0) then return hubs.hublist end
return nil
end
function get_queue_from_list(name, list_subscribers)
for _,q in pairs(list_subscribers.postroute) do
if q.name == name then return q end
end
return nil
end
funcion ListQueuesPerHub ()
-- missing functions for running through queue and write alarms and QOS
end
-- main entry
for _,hub in pairs(gethubs()) do
subscribers, rc = nimbus.request(hub.addr, "list_subscribers")
if rc == 0 then
queue = get_queue_from_list("probeDiscovery", subscribers
--Consider rewrite to run trough any hubQueue by function ListQueuesPerHub instead of single run pr quoue
if queue ~= nil then
-- Consider rewrite to collect sent messages vs messages in queue.
-- qos_name = hub.name.."_"..queue.name
-- nimbus.qos ("QOS_queue_COUNT",nil, qos_name, queue.npds, 300)
if queue.npds > 500 then
--nimbus.alarm(3, string.format("%s %s has %d messages", hub.name, queue.name, queue.npds), string.format("%s-%s", hub.name, queue.name))
--printf("queue %s found on %s. Count: %s", "probeDiscovery", hub.name, queue.npds)
end
else
--printf("queue %s not found on %s", "probeDiscovery", hub.name)
end
end
end
------------------------------
Senior engineer
NetNordic.com
Norway
------------------------------