This may be due to the number of concurrent SSH sessions you have allowed on your NCM instance, or the remote console time limitations you have set on your device. Since the job was only run on one device, I am assuming the connection is timing out because of the remote console time limitation. If I recall correctly, this can be easily fixed by adding 'exit' to the end of the script. Try re-running the job after you add the exit and let me know if you continue to have issues.
Adding exit didnt help. Tried end as well and it didnt help. I removed the second show version just to shorten the length of time to get all commands done. Also, I have the vty configured as such:
This is a Cisco n9508. I think there should be enough vty lines and long enough to run the command....
The funny thing is the commands work and finish. Just can't tell what it is doing to refuse connection
Any other ideas?
Is the job only executing on one specific node right now? Perhaps try end AND exit? Maybe the initial exit only took it out of priv exec, similar to the end?
Yeah, just one switch... Tried exit end, you never see the exit or end. Tried end exit, you see the end but not the exit
ERROR: Connection Refused.
If you run a show log on the switch, are you seeing any issues there? Maybe it will tell you why the connection was refused.
Have you tried breaking that into individual jobs such as:
Job 1: show version
Job 2: copy running-config startup-config
This way you can see the outcome and why it is failing with ERROR: Connection Refused
In my experience, the problem could be when you save the configuration using the command "copy running-config startup-config" it usually wants a confirmation like "Destination filename [startup-config]?". At this point if you were doing it through CLI, you would just hit enter. If you did it from a CLI and just let it sit there without a response, you would eventually encounter a timeout error. Maybe instead of "copy running-config startup-config" try using 'write memory' which accomplishes the same thing except that you don't have to respond to the question of a destination filename. I use this in a job that syncs the running-config and startup-config nightly. This is just in case I made a change and forgot to run either copy running-config startup-config or write memory when I was done. Oh yeah, as Bryan said, don't forget to add exit at the end to essentially end the session.
Just some thoughts.
2 of 2 people found this helpful
So I think I figured it out. It doesnt like the comments at the top. There are no log messages on the switch when it fails. I removed all the comments from teh front of the script and now it works fine (with both sh ver and copy r s).
And this was a copy of the built in example script... Weird.
Moral of the story, don't comment your script
Just FYI. Nexus doesnt have "write memory" You have to use "copy run start"
Glad you figured it out. Thanks for the FYI. I know that with all the flavors of IOS and IOS XE as well as their version, I didn't realize that the nexus line didn't use write memory.