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

Im trying to use snmp to get information from an APC PDU 88xx series, but i don't fully understand the lua scipts for this function.
Could some one help me with this?
Do you have anything in the logs?
I've tried some things and then i only get errors, but thats because i don't understand the script above since im not sure what I need to edit to connect to the device. If i only copy the script nothing appears in the logs
From what I see the only thing you can change here is the UDP port.
Okey, so as far as i understand, this script will continusly listen on the 162 port for information.
Then it might be the PDU setup that is wrong and not sending the info to the logicmachine correctly
This example is for SNMP traps (notifications). LM acts a server so you might need to adjust trap sending settings on your SNMP device.
What you probably need is to read/write data from SNMP device. See this thread for examples:

Forum Jump: