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) |
RE: SNMP protocol in Logic Machine - admin - 16.10.2018 You can also try adding ups1:close() to the end of each resident script. RE: SNMP protocol in Logic Machine - Carlos Padilla - 02.11.2018 Thanks for your collaboration, with the last thing that I indicated, the problem was solved and I no longer drop the connection. RE: SNMP protocol in Logic Machine - DGrandes - 09.04.2019 Hi, I have a problem with snmp conection. I have this script: Code: require "snmp" When I play resident script (5s) it work fine, but later, i get the following error: Resident script:18: netsnmp: Unknown host (192.168.2.201) stack traceback: [C]: in function 'assert' Can you help me? Thanks RE: SNMP protocol in Logic Machine - DGrandes - 11.04.2019 Hi. I have been loging data and I have created a script that restarts the snmp script when it fails, and it works again. I have verified that the snmp script fails exactly every 2.5h Any idea? RE: SNMP protocol in Logic Machine - admin - 11.04.2019 Your script is incorrect, it must have ups1:close() instead of ups1.close() This caused open sessions not to close properly so the script hits open socket limit after some time. RE: SNMP protocol in Logic Machine - DGrandes - 11.04.2019 (11.04.2019, 09:52)admin Wrote: Your script is incorrect, it must have ups1:close() instead of ups1.close() I had not seen it.... Thanks!!! RE: SNMP protocol in Logic Machine - DGrandes - 17.06.2019 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' Code: require "snmp" Any idea? Thanks RE: SNMP protocol in Logic Machine - admin - 17.06.2019 Change MyIP to real IP address of your SNMP device RE: SNMP protocol in Logic Machine - DGrandes - 17.06.2019 MyIP =192.168.2.201 RE: SNMP protocol in Logic Machine - admin - 17.06.2019 Post full listing of your script. The error that you have is at line 45 whereas the code you posted has only 25 lines. RE: SNMP protocol in Logic Machine - DGrandes - 17.06.2019 Sorry, here full script: Code: require "snmp" RE: SNMP protocol in Logic Machine - DGrandes - 18.06.2019 Hi, Here another error that give me many times: From 17:30 to 8:35AM last time. Now works again. Resident script:49: attempt to index global 'vbind' (a nil value) stack traceback: RE: SNMP protocol in Logic Machine - admin - 18.06.2019 This happens because there's no error check for get() calls. Use this code: Code: for _, item in ipairs(OID_NAS) do RE: SNMP protocol in Logic Machine - DGrandes - 18.06.2019 (18.06.2019, 08:05)admin Wrote: This happens because there's no error check for get() calls. Ok, I´ll try it. Thanks!! RE: SNMP protocol in Logic Machine - Carlos Padilla - 10.07.2019 Hello forum partners. Now I have two devices. The first is a projector which has an SNMP communication and I want to turn on and off, change the video input for which I have to write a value in the respective OIDs. I tested the projector both by writing and reading the SNMP variables by means of an SNMP management software and it works without any problem, but with the LM I have made a script by event to turn it on, but it does not work for me. On the other hand I have a team that uses SNMP Version 3 which replaces the community by user name, an authentication code, a privacy code and the protocol of these (MD5, SHA, DES, AES) which is not compatible with the current code, in addition to having some Tramps which I have to be aware of and I do not know how to do it, so if they have any way of doing it, it would be very helpful. I include the code I did to write about an SNMP OID, which does not work for me. Thank you and I am attentive to your comments. Code: val=event.getvalue() RE: SNMP protocol in Logic Machine - admin - 11.07.2019 See library documentation on how to correctly call set function: http://luasnmp.luaforge.net/snmp.html#snmp_set I haven't tried using SNMPv3, but you can try this code: Code: ups1, err = snmp.open({ SNMP traps are not supported at this moment. RE: SNMP protocol in Logic Machine - Carlos Padilla - 11.07.2019 Hi Admin, thanks for replying. With the help of the library manual I understand the script a bit more, in addition to the version 3 SNMP, and then I will try to try the version with what the manual says. The problem I have is to write to an OID, I have already tried many things but it still does not work, I have even commented, tried several parts of the code but it still does not work. I put it together to see if I'm wrong about something. Thank you and I am attentive to your comments Code: val=event.getvalue() RE: SNMP protocol in Logic Machine - admin - 12.07.2019 Here's an example script that sets identity on Mikrotik router via SNMP. You can modify it for your device. Resulting status or error will be visible in Alerts tab. Code: require('snmp') RE: SNMP protocol in Logic Machine - Carlos Padilla - 12.07.2019 Hi Admin, thanks for replying. Use the code you told me, but it's not working. I have attached the code adapted to my OID and my IP together with an error log. I have made several modifications but none of them work for me. Thank you and I am attentive to your comments. Code: val=event.getvalue() Event for ON/OFF_PROYECTOR (0/1/0) 12.07.2019 09:47:23 * string: snmp: bad type (2) prim=0 in index 1 Event for ON/OFF_PROYECTOR (0/1/0) 12.07.2019 09:47:23 * string: snmp set failed I have the library libnetsnmp 5.4.4-1 luasnmp 1.0.6-2-2 RE: SNMP protocol in Logic Machine - Carlos Padilla - 13.07.2019 Hi, I share with you the script by event that works to turn an EPSON projector on and off using snmp. Code: val=event.getvalue() |