These days almost every major OEM has some sort of API or ToolKit available for connecting to and automating their systems. However, you may not have the necessary system requirements on your local machine or regulations at a site may prevent you from using the utilities. Sometimes the OEM owned tools are just not an option.
The one connection technology that you can almost always rely on though is SSH. Thanks to the nifty Python library Paramiko I was able to put together a script that will:
- Establish an SSH Connection to a host
- Run a set of CLI Commands
- Capture the CLI output and print the content to the terminal
The use cases are endless but one that I’m personally excited about is easily creating a automatically generated, repeatable As-Built document.
To utilize the script you’ll first want to enter relevant host information.
ssh.connect('$host_ip', username='$username', password='$password')
From there you will just need to enter the CLI commands to run.
cli_commands = ['$cli_command_1','$cli_command_2','$etc']
Beyond that you shouldn’t have to modify anything. However, we highly encourage everyone to fork the repo and contribute to and improve upon the code.
To access the script check out the repo under the DatacenterDudes GitHub organization.