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
#31
Sorry, here full script:

Code:
require "snmp"

--local mib,err = snmp.mib.load ('/home/ftp/snmp/....mib')
--[[
if not mib then
 log ('Fallo carga Mib: '..err)
end]]

local IP_NAS = "192.168.2.201"
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
 {'38/2/5',".1.3.6.1.4.1.24681.1.2.11.1.3.1"}, --Temperatura HD 1
 {'38/2/6',".1.3.6.1.4.1.24681.1.2.11.1.3.2"}, --Temperatura HD 2
 {'38/2/7',".1.3.6.1.4.1.24681.1.2.11.1.3.3"}, --Temperatura HD 3
 {'38/2/8',".1.3.6.1.4.1.24681.1.2.11.1.3.4"}, --Temperatura HD 4
 {'38/2/9',".1.3.6.1.4.1.24681.1.2.11.1.4.1"}, --Estado del HD 1
 {'38/2/10',".1.3.6.1.4.1.24681.1.2.11.1.4.2"}, --Estado del HD 2
 {'38/2/11',".1.3.6.1.4.1.24681.1.2.11.1.4.3"}, --Estado del HD 3
 {'38/2/12',".1.3.6.1.4.1.24681.1.2.11.1.4.4"}, --Estado del HD 4
 {'38/2/13',".1.3.6.1.4.1.24681.1.2.11.1.6.1"}, --Capacidad Disco duro 1
 {'38/2/14',".1.3.6.1.4.1.24681.1.2.11.1.6.2"}, --Capacidad Disco duro 2
 {'38/2/15',".1.3.6.1.4.1.24681.1.2.11.1.6.3"}, --Capacidad Disco duro 3
 {'38/2/16',".1.3.6.1.4.1.24681.1.2.11.1.6.4"}, --Capacidad Disco duro 4
 {'38/2/17',".1.3.6.1.4.1.24681.1.2.11.1.7.1"}, --Smart Info HD 1
 {'38/2/18',".1.3.6.1.4.1.24681.1.2.11.1.7.2"}, --Smart Info HD 2
 {'38/2/19',".1.3.6.1.4.1.24681.1.2.11.1.7.3"}, --Smart Info HD 3
 {'38/2/20',".1.3.6.1.4.1.24681.1.2.11.1.7.4"}, --Smart Info HD 4
 {'38/2/21',".1.3.6.1.4.1.24681.1.2.13.0"}, --Hostname
 {'38/2/22',".1.3.6.1.4.1.24681.1.2.17.1.2.1"}, --Descripcion del Volumen
 {'38/2/23',".1.3.6.1.4.1.24681.1.2.17.1.4.1"}, --Capacidad total del volumen
 {'38/2/24',".1.3.6.1.4.1.24681.1.2.17.1.5.1"}, --Espacio Libre Volumen
 {'38/2/25',".1.3.6.1.4.1.24681.1.2.17.1.6"}, --Estado del volumen
}

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()
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 DGrandes - 17.06.2019, 09:29
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 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: