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 protocol in Logic Machine
#39
Hi Admin, thanks for replying. Use the code you told me, but it's not working. I have attached the code adapted to my OID and my IP together with an error log. I have made several modifications but none of them work for me. Thank you and I am attentive to your comments.

Code:
val=event.getvalue()
--Abrir una sesión con snmp
require('snmp')

conn, err = snmp.open({
  version = snmp.SNMPv1,
  community = 'public',
  peer = '192.168.1.248',
})

if conn then
  res, err = conn:set({
    {
      oid = '1.3.6.1.4.1.1248.4.1.1.2.1.0',
        value = '0',
    }
  })

  if err then
    alert('snmp set failed: ' .. tostring(err))
    log (err)
    log ('snmp set failed')
  else
    alert('snmp set ok')
    log ('snmp set ok')
  end

  conn:close()
else
  alert('snmp connection failed: ' .. tostring(err))
  log ('snmp connection failed')
end

Event for ON/OFF_PROYECTOR (0/1/0) 12.07.2019 09:47:23
* string: snmp: bad type (2) prim=0 in index 1


Event for ON/OFF_PROYECTOR (0/1/0) 12.07.2019 09:47:23
* string: snmp set failed


I have the library
libnetsnmp 5.4.4-1
luasnmp 1.0.6-2-2
Reply


Messages In This Thread
RE: SNMP protocol in Logic Machine - by AEK - 04.09.2018, 09:17
RE: SNMP protocol in Logic Machine - by AEK - 06.09.2018, 06:59
RE: SNMP protocol in Logic Machine - by admin - 06.09.2018, 07:57
RE: SNMP protocol in Logic Machine - by admin - 07.09.2018, 07:00
RE: SNMP protocol in Logic Machine - by admin - 11.09.2018, 06:41
RE: SNMP protocol in Logic Machine - by AEK - 11.09.2018, 09:26
RE: SNMP protocol in Logic Machine - by admin - 12.09.2018, 05:58
RE: SNMP protocol in Logic Machine - by admin - 15.10.2018, 18:10
RE: SNMP protocol in Logic Machine - by admin - 16.10.2018, 10:30
RE: SNMP protocol in Logic Machine - by admin - 16.10.2018, 17:50
RE: SNMP protocol in Logic Machine - by admin - 11.04.2019, 09:52
RE: SNMP protocol in Logic Machine - by admin - 17.06.2019, 07:34
RE: SNMP protocol in Logic Machine - by admin - 17.06.2019, 08:34
RE: SNMP protocol in Logic Machine - by admin - 18.06.2019, 08:05
RE: SNMP protocol in Logic Machine - by admin - 11.07.2019, 08:48
RE: SNMP protocol in Logic Machine - by admin - 12.07.2019, 06:15
RE: SNMP protocol in Logic Machine - by Carlos Padilla - 12.07.2019, 15:33

Forum Jump: