There are a few problems here.
You are mixing arrays and pds's so your loop is not going to work (#al=0)
But my first question is why alarm.list ?
It won't work with the AO profile as only alarm.get() works that way so "al” will be empty.
If this is triggered by an alarm then you need to use alarm.get().
I think you are trying to run this script for all your alarms of "Max restarts….” In which case you don't need the loop.
For loops are only used when, for example, you are processing multiple rows from a database call.
Also I don't see the point of the sleep(100).
Here's is what I would code, if I understand your req's correctly…
al = alarm.get ()
if al ~= nil then
if al.prid == "controller" then
if string.match(al.message,"Max. restarts reached for probe") then
print("message match")
probe = string.gsub(string.match(al.message,re),"'","")
print(al.message.."! Probe-> "..probe)
addr = "/"..al.domain.."/"..al.hub.."/"..al.robot.."/".."controller"
printf("/"..al.domain.."/"..al.hub.."/"..al.robot.."/".."controller".."<->Probe="..al.prid)
local args = pds.create()
pds.putString(args,"name",probe)
nimbus.request(addr,"_stop",args)
pds.delete(args)
--sleep (100)
end
end
end
also you proabably should put some error handling after the nimbus.request.
cheers