I gave up on Pinger plugins, decided to create a small LUA routine myself. It calls a ping via os.execute.
Works OK, except it takes a long time when a target is not available. I tried the timeout setting but that makes no difference.
Beside that, I am happy.
In case someone is interested, here's the code:
Code: Select all
function Ping (IP)
local handler = io.popen("ping -c 1 "..IP)
local response = handler:read("*a")
i, j = string.find(response, "Destination Host Unreachable")
return (i == nil)
end
Call the function like this:
Code: Select all
if Ping(DeviceArray[i][2]) then
commandArray[DeviceArray[i][1]] = "On"
-- print ("@@@@@@@@@@@@@@@ ping "..DeviceArray[i][2]..", result: on")
else
commandArray[DeviceArray[i][1]] = "Off"
-- print ("@@@@@@@@@@@@@@@ ping "..DeviceArray[i][2]..", result: off")
end
Where DeviceArray contains IP address as first element, and name of device to reflect the status as second element.
For timeout, I tried adding the "-W 1" parameter, but it then always returns true even for IP addresses that I know are not running.