11.07.2019, 22:13
Hi Admin, thanks for replying. With the help of the library manual I understand the script a bit more, in addition to the version 3 SNMP, and then I will try to try the version with what the manual says. The problem I have is to write to an OID, I have already tried many things but it still does not work, I have even commented, tried several parts of the code but it still does not work. I put it together to see if I'm wrong about something. Thank you and I am attentive to your comments
Code:
val=event.getvalue()
--Abrir una sesión con snmp
require "snmp"
--value=1
ups1, err = snmp.open{
version = snmp.SNMPv1,
community = "public",
port = 161,
peer = "192.168.0.248",
}
assert(ups1, err)
vbOut, err = ups1:set("1.3.6.1.4.1.1248.4.1.1.2.1.0", 0)
--vlist = {
--{oid = "1.3.6.1.4.1.1248.4.1.1.2.1.0", 0}
--}
--vbind = {
--{oid = "1.3.6.1.4.1.1248.4.1.1.2.1.0", type = TYPE_INTEGER32, value = "0"}
--}
--vbOut, err = ups1:set(vbIn)
--vbOut, err = ups1:set(vbind)
log(vbind)
log(err)
log(index)
--assert(vbOut, err)
--if value==true then
--vbind, err = ups1:set("1.3.6.1.4.1.1248.4.1.1.2.1.0", 1)
--else
--vbind, err = ups1:set("1.3.6.1.4.1.1248.4.1.1.2.1.0", 0)
--end
ups1:close()