NCM script to capture config from HP switches using SSH. We had some issues with NCM hanging on certain devices, so we have some built in workarounds. Not the best way since it won't log the device as failed, but at least the NCM task will finish this way. You will need Net::SSH2, Net::SSH2::SFTP and Time::HiRes for this script to work.
The startup or running config is determined by setting the scp_file parameter in your NCM config. For the startup config it would look like this:
At some point HP introduced the ip ssh filetransfer feature on their Procurve switches. With this feature you can use SCP/SFTP to fetch a config, and that is what this script does.
On the command line it would look something like this:
scp myswitch:/cfg/startup-config myswitch.conf
What the script does is fetch the file configured in scp_file using sftp and then send it to NCM, If your switches fail because you require an enable password to that (you will probably get the message "Can not open subsystem SFTP"), you should slightly modify the script to send the enable command with the password stored in $pw_enale before the sftp session is opened. But as far as I know that is not required if you're fetching a config.
How do you ask for the startup and running configurations? I don't see any difference in the script.
also, my Procurve devices require a password for the enable command. Does the scp process bypass this requirement somehow?