11.09.2018, 16:19
Okay. Thank you for your cooperation. Effectively change the final name of the route to the one of the OID and it is working for me, in the group addresses the requested OIDs are being written. It is important to clarify that despite the fact that the file is loading, I still get the message:
SNMP Mikrotik 11.09.2018 10:06:57
* string: Failed to load mib: mib: can not add mib
The only way that this message does not appear is to put in comments the part of the code that requests the file loaded by ftp. Based on the above, would the SNMP communication serve me without having to load the MIB file?, Only loading the 2 necessary libraries and making the script so that the information that the OIDs have is written in the group addresses. On the other hand, I currently have 40 OID per ups and are in total 4 ups that I must monitor the variables, to avoid problems, I can place the first Script to make requests every 2 seconds, the second script every 3 seconds, the third script at 5 and 7 respectively to avoid communication problems or I can place all the scripts to run every 2 seconds and I would not have problems with the communication and acquisition of the information.
I attach the code that works for me at the moment:
On the other hand, admin, if I want to implement the traps, you have information or the form of how to do it, what to do, some example or a base to start. For these UPS, it is not necessary the traps but in other devices if they are and I would like to have a complete solution with the logic machine. Thank you and I will be attentive to your comments.
SNMP Mikrotik 11.09.2018 10:06:57
* string: Failed to load mib: mib: can not add mib
The only way that this message does not appear is to put in comments the part of the code that requests the file loaded by ftp. Based on the above, would the SNMP communication serve me without having to load the MIB file?, Only loading the 2 necessary libraries and making the script so that the information that the OIDs have is written in the group addresses. On the other hand, I currently have 40 OID per ups and are in total 4 ups that I must monitor the variables, to avoid problems, I can place the first Script to make requests every 2 seconds, the second script every 3 seconds, the third script at 5 and 7 respectively to avoid communication problems or I can place all the scripts to run every 2 seconds and I would not have problems with the communication and acquisition of the information.
I attach the code that works for me at the moment:
Code:
--Abrir una sesión con snmp
require "snmp"
--local mib, err = snmp.mib.load('/home/ftp/snmp/Mikrotik.mib')
--if not mib then
--log('Failed to load mib: ' .. err)
--end
ups1, err = snmp.open{
version = snmp.SNMPv1,
community = "ZennioCo",
port = 161,
peer = "192.168.0.192",
}
assert(ups1, err)
--Lee los OID del Mib
vbind, err = ups1:get("1.3.6.1.4.1.14988.1.1.3.8.0")
grp.write('8/0/0', vbind.value)
vbind, err = ups1:get("1.3.6.1.4.1.14988.1.1.3.10.0")
grp.write('8/0/1', vbind.value)
vbind, err = ups1:get("1.3.6.1.4.1.14988.1.1.1.3.1.9.16.0")
grp.write('8/0/2', vbind.value)
On the other hand, admin, if I want to implement the traps, you have information or the form of how to do it, what to do, some example or a base to start. For these UPS, it is not necessary the traps but in other devices if they are and I would like to have a complete solution with the logic machine. Thank you and I will be attentive to your comments.