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 whether you accept or reject these cookies being set.

SNMP v1/v2c trap support
New package with trap support:

Resident script (0 second sleep time). It binds to UDP port 162 and listens to incoming messages then parses them. snmp.parsetrap returns community name (string) and variable list (table) on success, nil plus error message otherwise.
if not sock then
  snmp = require('snmp')
  socket = require('socket')

  -- create UDP socket, listen on port 162
  sock = socket.udp()
  sock:setsockname('*', 162)

data, ip, port = sock:receivefrom()

-- incoming message
if data then
  -- parse message
  commres, vberr = snmp.parsetrap(data)

  -- valid message
  if commres then
    log(ip, commres, vberr)
  -- parse failed, see logs for more info
    log('error', vberr)
Thanks admin. We will be testing it. Thank you

Forum Jump: