NetXMS Support Forum

English Support => General Support => Topic started by: AB3AI on March 25, 2018, 02:22:00 AM

Title: SNMPSet
Post by: AB3AI on March 25, 2018, 02:22:00 AM
GE All,

I have a reset OID that i want to send to a node. The node sits behind a server with an agent running on it. All the DCIs are working fine. How would I send SNMPSet OID to the node to reset (or any other Set command)? I've searched this forum and Google. I've tried different Object Tools and Server Scripts and I can get it to work. Any help would be greatly appreciated.

Thanks!
Title: Re: SNMPSet
Post by: Tursiops on March 27, 2018, 03:18:12 PM
You can create a script, which can then be called via Object Tools.
For example the following works to reboot Cisco routers:
snmpTransport = CreateSNMPTransport($node);
if ( snmpTransport == null ) return "Unable to connect";
returnValue = SNMPSet(snmpTransport,"1.3.6.1.4.1.9.2.9.9.0","2","INTEGER");
if ( returnValue == null ) return "No response. Something went wrong.";
if ( returnValue == 0 ) return "Unable to initiate reload. No SNMP Write Access?";
if ( returnValue == 1 ) return "Reload triggered.";


In the Object Tools configuration, you create a new Tool of type Server Script and call the script you saved by name. So if the above was called "ReloadCisco" in your Script Library, then that's what you'd call.
You will probably also want to filter the Object Tool to ensure it doesn't show against systems that can't handle it.
And of course you have to have SNMP Set/Writes enabled on the device and have that community configured on the node in NetXMS.

Title: Re: SNMPSet
Post by: AB3AI on March 31, 2018, 09:02:37 PM
Tursiops,

Thanks for the reply! I had a chance to try your script. I followed the instructions to implement the script and I all received was a message that it executed successfully. The camera did not reset and I also tried it on a switch. I double checked the write community string. I'm going to have to double check again and make sure I have everything set up correctly.

Thanks!!