Using paramiko, ssh connections can be implemented in Python. I have written a simple nagios plugin to check status of disks on the Netapp 8020 Storage on which Clustered Data ONTAP 8.3 runs. Python version is 2.6.6.
Most of the time, managing lots of network devices are troublesome if you do not have a proper management software. In this post i will go through an example. The task that i want to achieve is getting existing tunnel configuration of cisco network devices, then creating a new tunnel configuration using them.
First install expect packages. In my case i use ubuntu: # sudo apt-get install expect
Make a directory for logs: # mkdir /tmp/expect_logs
There are some text files and bash, expect scripts:
1. devices_list : IP list of the cisco network devices.
2. cisco.sh : Main Bash script.
3. expect_get.exp : Expect script for getting existing device config.
4. expect_put.exp : Expect script for creating a new device config.
Contents of the scripts accordingly:
Running cisco.sh in a while loop should do the trick. # while read -r line; do ./cisco.sh $line; done < devices_list
qemu-img is a practical tool to convert between multiple virtual disk image formats. As of qemu-img-0.12.1.2-2.479.el6.x86_64 supported formats are in the following list. raw: Raw disk image format qcow2: QEMU image format (copy-on-write) qcow: Old QEMU image format cow: User Mode Linux copy-on-write image format vdi: VirtualBox 1.1 compatible image format vmdk: VMware 3 and 4 compatible image format vpc: VirtualPC compatible image format (VHD) vhdx: Hyper-V compatible image format (VHDX) cloop: Linux Compressed Loop image
A few examples:
kvm raw image to qcow2 $ qemu-img convert -f raw -O qcow2 raw-image.img qcow2-image.qcow2
kvm raw image to vmdk $ qemu-img convert -f raw -O vmdk raw-image.img vmware-image.vmdk
vmdk to raw image $ qemu-img convert -f vmdk -O raw vmware-image.vmdk raw-image.img
vmdk to qcow2 $ qemu-img convert -f vmdk -O qcow2 vmware-image.vmdk qcow2-image.qcow2
vdi to qcow2 $qemu-img convert -f vdi -O qcow2 vbox-image.vdi qcow2-image.qcow2