Get disk usage for all the containers with python script

2017-01-16 1 min read Python
With my increasing love for python, here is my attempt to get the disk usage of all the containers on some host. Well, since the requirements vary for everyone, so this script is far from complete. import docker import json # We will connect to 192.168.122.1 for docker daemon. If that is not the case, # then change the below. client = docker.DockerClient(base_url="tcp://192.168.122.1:4243") # Get list of all containers. cls=client.containers.list() stats={} # And now we will iterate over that list to get stats for all the containers. Continue reading

Python script to manage virtual machines with python API for libvirt.

2016-07-04 4 min read Vurtualization
Most of times I use virt-manager to manage VMs but sometimes, I have to manage VMs on other hosts over ssh when connected over VPN or while I am working remotely. GUI like virt-manager thus becomes slow, and hence I like to use cli commands and nothing is better than virsh. But here is simple script that I use sometimes to manage the VMs with CLI based menu. Hope you find it useful. Continue reading