How to turn interfaces on and off with a single SNMP command

Started by r1993r

With the newly added features, I now have the Port Mapper turning interfaces on and off, achieved by a single SNMP command:
snmpset -r:%0 -v:3 -sn:SNMPNAME -ap:SHA -aw:AUTHPW -pp:DES -pw:PRIVPW -O:.1.3.6.1.2.1.2.2.1.7.[Port ID] -val:1 -tp:int
snmpset -r:%0 -v:3 -sn:SNMPNAME -ap:SHA -aw:AUTHPW -pp:DES -pw:PRIVPW -O:.1.3.6.1.2.1.2.2.1.7.[Port ID] -val:2 -tp:int
-val:1 being UP
-val:2 being DOWN
SnmpSet.exe [-q] -r:host [-p:port] [-t:timeout] [-v:version] [-c:community]
[-ei:engine_id] [-sn:sec_name] [-ap:auth_proto] [-aw:auth_passwd]
[-pp:priv_proto] [-pw:priv_passwd] [-ce:cont_engine] [-cn:cont_name]
-o:var_oid -val:value [-tp:type]

Now to figuring out how to change the port status in Port Mapper to match... lol... Only joking!!! :)
VLAN change next.

Re: How to turn interfaces on and off with a single SNMP command   28 October 2020, 19:56

In addition to the above I wanted to point out that the config is specific to Cisco switches and used the external SNMPSET (free) command line program for pushing the SNMP command to the switch. It makes use of the recently added feature whereby you can parse Column headers from the app into the command making the insertion of the [Port ID] possible and also the IP of the switch "%0". You must also have a writeable SNMP configuration on your switch.

The above command can be used via the File>Settings>Applications menu to create a right-click "Open Switch" option when selecting the interface.

I haven't really thought of other possibilities for this as I was mainly focused on changing the port state and also changing the vlan for the port, which is my next bit of research and hopefully just as simple once I know the OID. The only limit being is that it must be done from a single one-line command.

Would be good to see if this is of any use to any one else, or if they can come up with other use cases!

Would be interesting to hear if after running a command the app could trigger another read for that particular interface to update the change that was made... but I've burdened the dev team with many feature requests over the last few weeks, and just want to say a huge thanks to everyone for making my job more efficient by offering this app!
SoftPerfect Support forum - Andrew avatar image

Re: How to turn interfaces on and off with a single SNMP command   29 October 2020, 08:14

Quote

r1993r

Would be interesting to hear if after running a command the app could trigger another read for that particular interface to update the change that was made...


The problem with this is that we don't really know what a specific external command does and what bits of information must be updated.

I guess at some point we might implement simple built-in commands (like enable/disable port) and in this case it should be possible to update the data without a complete rescan.

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 ********   ********  **    **  **     **  **    ** 
 **     **  **        ***   **  **     **   **  **  
 **     **  **        ****  **  **     **    ****   
 **     **  ******    ** ** **  **     **     **    
 **     **  **        **  ****   **   **      **    
 **     **  **        **   ***    ** **       **    
 ********   ********  **    **     ***        **    

Message: