def list(type='all'): cs = docker.get_containers(details=True) print '%-12s %-10s %-30s %-15s %-7s %s' % ('Id', 'Type', 'Name', 'IP', 'DB port', 'Running') for c in cs: if c['running']: color = 'green' else: color = 'red' cid = colored(c['id'], color) print '%-12s %-10s %-30.30s %-15s %-7s %s' % (cid, c['type'], c['name'], c.get('ip', ''), c.get('db_port', ''), c['running'])
def list(type='all'): cs = docker.get_containers(details=True) print '%-12s %-10s %-30s %-15s %-7s %s' % ('Id', 'Type', 'Name', 'IP', 'DB port', 'Running') for c in cs: if c['running']: color = 'green' else: color = 'red' cid = colored(c['id'], color) print '%-12s %-10s %-30.30s %-15s %-7s %s' % ( cid, c['type'], c['name'], c.get('ip', ''), c.get( 'db_port', ''), c['running'])
def index(): try : import psutil mem_total = psutil.virtual_memory().total / 1024 / 1024 mem_available = psutil.virtual_memory().available / 1024 / 1024 mem_percent = psutil.virtual_memory().percent load = ', '.join([str(l) for l in os.getloadavg()]) except ImportError: mem_total = mem_available = mem_percent = load = 'NA' plugins = docker.getPluginNames() containers = docker.get_containers(details=True) return render_template('index.html', containers=containers, mem_total=mem_total, mem_available=mem_available, mem_percent=mem_percent, load=load, plugins=plugins)
def index(): try: import psutil mem_total = psutil.virtual_memory().total / 1024 / 1024 mem_available = psutil.virtual_memory().available / 1024 / 1024 mem_percent = psutil.virtual_memory().percent load = ', '.join([str(l) for l in os.getloadavg()]) except ImportError: mem_total = mem_available = mem_percent = load = 'NA' plugins = docker.getPluginNames() containers = docker.get_containers(details=True) return render_template('index.html', containers=containers, mem_total=mem_total, mem_available=mem_available, mem_percent=mem_percent, load=load, plugins=plugins)