17.06.2019, 06:59
Hi, my script still doesn´t work (only sometimes). I get the same error:
Resident script:45: netsnmp: Unknown host ("MyIP")
stack traceback:
[C]: in function 'assert'
Any idea?
Thanks
Resident script:45: netsnmp: Unknown host ("MyIP")
stack traceback:
[C]: in function 'assert'
Code:
require "snmp"
local IP_NAS = "MyIP"
local OID_NAS = {
{'38/2/1',".1.3.6.1.4.1.24681.1.2.1.0"}, --Uso de la CPU
{'38/2/2',".1.3.6.1.4.1.24681.1.2.2.0"}, --Memoria total del sistema
{'38/2/3',".1.3.6.1.4.1.24681.1.2.3.0"}, --Memoria libre
{'38/2/4',".1.3.6.1.4.1.24681.1.2.4.0"}, --Tiempo en linea
}
ups1, err = snmp.open{
version = snmp.SNMPv2,
community = "public",
port = 161,
peer = IP_NAS,
}
assert(ups1, err)
for i = 1, #OID_NAS, 1 do
vbind, err = ups1:get(OID_NAS[i][2])
grp.update(OID_NAS[i][1], vbind.value)
end
ups1:close()
Any idea?
Thanks