This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

ModBus IP / RTU error com
#2
Use a scheduled script:
Code:
key = 'modbus_error_time'
time = storage.get(key, 0)

items = db:getall([[
  SELECT *
  FROM modbus_errors
  WHERE errortime>?
  ORDER BY errortime
]], time)

if #items == 0 then
  return
end

texts = {}

for _, item in ipairs(items) do
  time = item.errortime
  date = os.date('%c', time)
  texts[ #texts + 1 ] = date .. ' - ' .. item.errortext
end

message = table.concat(texts, '\n')
mail('user@example.com', 'Modbus errors', message)

storage.set(key, time)
Reply


Messages In This Thread
ModBus IP / RTU error com - by Gadjoken - Yesterday, 14:18
RE: ModBus IP / RTU error com - by admin - 5 hours ago

Forum Jump: