SNMP protocol in Logic Machine - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: SNMP protocol in Logic Machine (/showthread.php?tid=1573) |
SNMP protocol in Logic Machine - Carlos Padilla - 03.09.2018 Good morning, the following message is to tell you that I have a monitor and manage the traps of several UPS and PDU that use the SNMP protocol. I read that with the logic Machine I can do this, but I can not find information about it, if I need some packages, if everything has to be done with Script or has menus like Modbus or other protocols. In addition to the above if I can monitor and also receive the traps of them, because going in a forum here, said that you could not receive traps, but I do not know if with the new version of the lite power firmware (20180822) if can do. Thanks and any information that you can give me, it would be very useful. RE: SNMP protocol in Logic Machine - AEK - 04.09.2018 (03.09.2018, 13:30)Carlos Padilla Wrote: Good morning, the following message is to tell you that I have a monitor and manage the traps of several UPS and PDU that use the SNMP protocol. I read that with the logic Machine I can do this, but I can not find information about it, if I need some packages, if everything has to be done with Script or has menus like Modbus or other protocols. In addition to the above if I can monitor and also receive the traps of them, because going in a forum here, said that you could not receive traps, but I do not know if with the new version of the lite power firmware (20180822) if can do. Thanks and any information that you can give me, it would be very useful. Hi, as I know, traps are still not supported You need packages luasnmp and libnetsnmp you can download it for imx28 here https://dl.openrb.com/lm-17/pkg for imx6 here https://dl.openrb.com/lm-17-imx6/pkg/ and here is example script Code: -- открытие сессии с snmp RE: SNMP protocol in Logic Machine - Erwin van der Zwart - 04.09.2018 Hi, This sample is a client, can we also use it as server? BR, Erwin RE: SNMP protocol in Logic Machine - AEK - 06.09.2018 (04.09.2018, 14:10)Erwin van der Zwart Wrote: Hi, Hi Erwin! Better ask Admin, he implemented this solution RE: SNMP protocol in Logic Machine - admin - 06.09.2018 Trap server can implemented but it's not straightforward because of extra configuration that is required. RE: SNMP protocol in Logic Machine - Carlos Padilla - 06.09.2018 (06.09.2018, 07:57)admin Wrote: Trap server can implemented but it's not straightforward because of extra configuration that is required. It does not matter if it is difficult, I would like to try to implement it. What makes it difficult? Thanks for answering. On the other hand, I observe in the example that was passed to me, there is a path ('/home/ftp/snmp/GESINGLEUPS.mib') where the MIB file is located, but the path looks like a computer or terminal linux or Is it a file that can be uploaded to the logic machine? RE: SNMP protocol in Logic Machine - admin - 07.09.2018 Files can be uploaded via ftp which can be enabled in System config. Using SNMP traps is difficult because it requires several separate software pieces to work - one to handle trap communication and another to decode trap messages. RE: SNMP protocol in Logic Machine - Carlos Padilla - 10.09.2018 Thank you for responding, I was able to upload a file to you via ftp with the help of winscp, as you can see in the images that I will show you. I am testing the SNMP communication with a Mikrotik router with the resident function of the example that AEK shows me, but it does not work for me. In the log I see that the message appears: SNMP Mikrotik 10.09.2018 17:09:25 * string: Failed to load mib: mib: can not add mib The script I use is the following: Code: --Abrir una sesión con snmp It should be noted that when configuring the ftp server of the logic machine only had username ftp and apps and in both mount the MIB but none worked and even mount the folder as is the example route ('/ home / ftp / snmp /*.*) since when I accessed the user I only showed "/" and apps (the daemon, daemon, data, lib and user folders), but the reading of the file does not work for me. In addition to the above, also install the 2 SNMP packets that I commented and that are necessary for the SNMP part to work. Thank you and I will be attentive to your comments. RE: SNMP protocol in Logic Machine - admin - 11.09.2018 ftp root directory is /home/ftp, you don't have to create full path there, just create snmp directory and upload mib file there. From my experience Mikrotik mib file does not work at all, at least with RB951G that we use for testing. You have to use oid instead of mibs. You can find out oids by going to Mikrotik console and running "print oid" command in a specific section, for example "/system health". RE: SNMP protocol in Logic Machine - AEK - 11.09.2018 (11.09.2018, 06:41)admin Wrote: ftp root directory is /home/ftp, you don't have to create full path there, just create snmp directory and upload mib file there. From my experience Mikrotik mib file does not work at all, at least with RB951G that we use for testing. You have to use oid instead of mibs. You can find out oids by going to Mikrotik console and running "print oid" command in a specific section, for example "/system health".same thing on hAP AC Light RE: SNMP protocol in Logic Machine - Carlos Padilla - 11.09.2018 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: Code: --Abrir una sesión con snmp 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. RE: SNMP protocol in Logic Machine - Carlos Padilla - 11.09.2018 (11.09.2018, 16:19)Carlos Padilla Wrote: 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: Ready, I respond to one of the previous questions, it is only necessary that the 2 packages are downloaded and installed, the resident script is set to run and the ip and the community are well configured, the communication will work. I even try changing from v1 to v2 of SNMP and it works for me without any problem. My doubt in the code is that if I want to write in an OID, some teams ask for a community of reading and writing, it is necessary to configure the same name for both communities in the team or in the script I can indicate the writing community, What name does the variable receive ?. On the other hand if I want to make the communication using SNMP Version 3, it is necessary to use a user name, an authentication code, a privacy code and the protocol of these (MD5, SHA, DES, AES). Where and with what name do I specify the above in the resident code? Thank you for your cooperation. RE: SNMP protocol in Logic Machine - admin - 12.09.2018 Here's a universal solution for reading from multiple SNMP peers. Create a resident script with sleep time > 0, adjust devices table as needed. You have to fully restart the script via enabled/disable when changing anything in devices table. Code: if not devices then As for traps and SNMP v3 - we'll look into it later on. RE: SNMP protocol in Logic Machine - ferrim - 12.09.2018 Great job guys, I follow you with interest and I look forward to new developments! RE: SNMP protocol in Logic Machine - Carlos Padilla - 12.09.2018 Okay. Thank you very much for your collaboration admin and I will be waiting for when you can tell us about the use of traps and also with the V3 of the SNMP protocol. For now with the information and the previous script, I could solve. Thank you very much. RE: SNMP protocol in Logic Machine - Carlos Padilla - 15.10.2018 Good guys, I told them that I have a problem with the request of the OID information of the UPS and that the code works for me, but after several hours, the code stops working and I have to disable and enable the resident function again so that the data can be updated, but after several hours again I can not obtain the values. I look at the error log and the following appears: Resident script: 16: netsnmp: Unknown host (192.168.0.114) stack traceback: [C]: in function 'assert' Resident script: 16: netsnmp: Unknown host (192.168.0.111) stack traceback: [C]: in function 'assert' The code is the following: Code: --Abrir una sesión con snmp RE: SNMP protocol in Logic Machine - admin - 15.10.2018 This means that LM cannot connect to certain devices. Check if you can ping devices from LM (System Config > Status > Network Utilities). RE: SNMP protocol in Logic Machine - Carlos Padilla - 15.10.2018 If, as I said, the devices are connected to the network and have communication, but as the hours pass, the updates of the variables are no longer received and the message of: Resident script: 16: netsnmp: Unknown host (192.168.0.111) stack traceback: [C]: in function 'assert' The message told me that the communication was lost, but I could access the UPS and verify that it was working normally. As I was saying, I had to disable and enable the script so that the reading of variables works again. This is a ping that I made to the UPS PING 192.168.0.111 (192.168.0.111): 56 data bytes 64 bytes from 192.168.0.111: seq = 0 ttl = 64 time = 1.401 ms 64 bytes from 192.168.0.111: seq = 1 ttl = 64 time = 0.623 ms 64 bytes from 192.168.0.111: seq = 2 ttl = 64 time = 0.721 ms 64 bytes from 192.168.0.111: seq = 3 ttl = 64 time = 0.638 ms --- 192.168.0.111 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min / avg / max = 0.623 / 0.845 / 1.401 ms On the other hand, even though I have a MIB file loaded, I get this error: * string: Failed to load mib: mib: can not add mib But even so, the variables are updated, only after several hours, the information is no longer updated. RE: SNMP protocol in Logic Machine - admin - 16.10.2018 This can be caused by not properly closed connections. A quick solution is to use a scheduled script which runs every minute instead of a resident script. RE: SNMP protocol in Logic Machine - Carlos Padilla - 16.10.2018 Thanks admin for answering and the script, although it would be scheduled, would have the effect that the connection does not close properly? Because in the end it has the same effects, I mean to ask every so often, in my case every 20, 30, 40 and 50 seconds respectively. In my case I have 4 UPS, so that would be 4 script scheduled, each in the minute option would be / * 1 for the first script, for the second / * 2, the third / * 3 and so respectively. An admin question and if in the script the connection is closed at the end, would it be better? Or it is better to use the second example that you placed, which I have no problem doing after the problem is solved. Thanks and I will be attentive to your comments, by the way it happened again that the scrip stopped working, so I sent a ping from the LM to the host and I had a response from him. I attach some images of it. |