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 that you accept these cookies being set.

SNMP protocol in Logic Machine
#54
(07.03.2020, 13:20)admin Wrote: Post full script that you are using to read values
Code:
local IP_Mikrotik = "192.168.2.1"
local OID_Mikrotik = {
  {'38/5/1',".1.3.6.1.2.1.25.2.3.1.5.65536"}, --Total Memowy
  {'38/5/2',".1.3.6.1.2.1.25.2.3.1.6.65536"}, --Used-Memory
  {'38/5/3',".1.3.6.1.2.1.25.3.3.1.2.1"}, --CPU Frecuency
  {'38/5/5',".1.3.6.1.4.1.14988.1.1.3.14.0"}, --Carga CPU
  {'38/5/11',".1.3.6.1.4.1.14988.1.1.14.1.1.2.1"}, --Interface 1 Name
  {'38/5/12',".1.3.6.1.4.1.14988.1.1.14.1.1.2.2"}, --Interface 2 Name
  {'38/5/13',".1.3.6.1.4.1.14988.1.1.14.1.1.2.3"}, --Interface 3 Name
  {'38/5/14',".1.3.6.1.4.1.14988.1.1.14.1.1.2.4"}, --Interface 4 Name
  {'38/5/15',".1.3.6.1.4.1.14988.1.1.14.1.1.2.5"}, --Interface 5 Name
  {'38/5/16',".1.3.6.1.4.1.14988.1.1.14.1.1.2.6"}, --Interface 6 Name
  {'38/5/17',".1.3.6.1.4.1.14988.1.1.14.1.1.2.7"}, --Interface 7 Name
  {'38/5/21',".1.3.6.1.4.1.14988.1.1.14.1.1.11.1"}, --Interface 1 TX bytes
  {'38/5/22',".1.3.6.1.4.1.14988.1.1.14.1.1.11.2"}, --Interface 2 TX bytes
  {'38/5/23',".1.3.6.1.4.1.14988.1.1.14.1.1.11.3"}, --Interface 3 TX bytes
  {'38/5/24',".1.3.6.1.4.1.14988.1.1.14.1.1.11.4"}, --Interface 4 TX bytes
  {'38/5/25',".1.3.6.1.4.1.14988.1.1.14.1.1.11.5"}, --Interface 5 TX bytes
  {'38/5/26',".1.3.6.1.4.1.14988.1.1.14.1.1.11.6"}, --Interface 6 TX bytes
  {'38/5/27',".1.3.6.1.4.1.14988.1.1.14.1.1.11.7"}, --Interface 7 TX bytes
  {'38/5/31',".1.3.6.1.4.1.14988.1.1.14.1.1.13.1"}, --Interface 1 RX bytes
  {'38/5/32',".1.3.6.1.4.1.14988.1.1.14.1.1.13.2"}, --Interface 2 RX bytes
  {'38/5/33',".1.3.6.1.4.1.14988.1.1.14.1.1.13.3"}, --Interface 3 RX bytes
  {'38/5/34',".1.3.6.1.4.1.14988.1.1.14.1.1.13.4"}, --Interface 4 RX bytes
  {'38/5/35',".1.3.6.1.4.1.14988.1.1.14.1.1.13.5"}, --Interface 5 RX bytes
  {'38/5/36',".1.3.6.1.4.1.14988.1.1.14.1.1.13.6"}, --Interface 6 RX bytes
  {'38/5/37',".1.3.6.1.4.1.14988.1.1.14.1.1.13.7"}, --Interface 7 RX bytes
  {'38/5/0',".1.3.6.1.2.1.2.2.1.8.1"}, --Interface 1 Up/Down (Para saber si ISP esta activo
}


ups1, err = snmp.open{
  version = snmp.SNMPv1,
  community = "MonitoreoLM",
  port = 161,
  peer = IP_Mikrotik,
}

assert(ups1, err)

for _, item in ipairs(OID_Mikrotik) do
  vbind, err = ups1:get(item[2])
  if vbind then
    --log(item[1],vbind.value)
    grp.checkupdate(item[1], vbind.value) 
  else
    alert('error reading from snmp: ' .. tostring(err))
  end
end

ups1:close()

Solved!. If I convert it to string and again to number it works.

Thanks!
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 admin - 04.11.2019, 12:12
RE: SNMP protocol in Logic Machine - by admin - 21.02.2020, 08:22
RE: SNMP protocol in Logic Machine - by admin - 06.03.2020, 12:26
RE: SNMP protocol in Logic Machine - by admin - 06.03.2020, 18:47
RE: SNMP protocol in Logic Machine - by admin - 07.03.2020, 13:20
RE: SNMP protocol in Logic Machine - by DGrandes - 08.03.2020, 17:22
RE: SNMP protocol in Logic Machine - by admin - 09.03.2020, 09:21
RE: SNMP protocol in Logic Machine - by admin - 28.03.2020, 15:06
RE: SNMP protocol in Logic Machine - by admin - 12.04.2020, 12:12
RE: SNMP protocol in Logic Machine - by admin - 15.04.2020, 06:08
RE: SNMP protocol in Logic Machine - by admin - 09.12.2020, 07:07
RE: SNMP protocol in Logic Machine - by admin - 11.03.2021, 13:15
RE: SNMP protocol in Logic Machine - by admin - 11.03.2021, 13:34
RE: SNMP protocol in Logic Machine - by admin - 11.03.2021, 14:22
RE: SNMP protocol in Logic Machine - by admin - 19.09.2022, 13:00

Forum Jump: