11-07-2006 05:59 AM
Hello
I wanted to enquire if there is any way by which I can execute a CLI command programmatically or even through an SNMP request.
I need to execute a CLI command(not through telenet etc) on a Cisco 1200 series AP in such a way.
Thanks
Nishchal
11-07-2006 06:31 AM
Assuming you have CiscoWorks.
RME, netconfig, adhoc.
SNMP may also be possible, however this method is much more complex.
11-07-2006 07:14 AM
If you are not rejecting telnet or ssh as the underlying mechanism completely, check out Expect, which makes what you're looking to do a trivial task:
11-07-2006 01:28 PM
The advice thus far has been about executing CLI commands via telnet. This is not what you want. There is a little-known trick where you can execute a CLI command via SNMP. To do this, you need to push a config snippet to the device's RUNNING CONFIG using the CISCO-CONFIG-COPY-MIB procedure outlined at http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a0080094aa6.shtml .
Your config snippet should contain the following:
do
end
For example:
do clear line 1
end
If you need to execute a show command, and save the output, you will need to use the redirect feature. For example:
do show ver | redirect flash:show_ver.txt
end
BE VERY CAREFUL you DO NOT do any interactive commands using this trick. If you do, you will lock the config until you next reload the device.
11-07-2006 01:35 PM
In the example above, is "do show ver" without the pipe considered an "interactive" command, i.e., does that lock the config?
11-07-2006 03:06 PM
Yes. Do not perform show commands without a redirection.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide