12.07.2019, 06:15
Here's an example script that sets identity on Mikrotik router via SNMP. You can modify it for your device. Resulting status or error will be visible in Alerts tab.
Code:
require('snmp')
conn, err = snmp.open({
version = snmp.SNMPv1,
community = 'public',
peer = '192.168.1.1',
})
if conn then
res, err = conn:set({
{
oid = '1.3.6.1.2.1.1.5.0',
value = 'New_Identity',
}
})
if err then
alert('snmp set failed: ' .. tostring(err))
else
alert('snmp set ok')
end
conn:close()
else
alert('snmp connection failed: ' .. tostring(err))
end