def ap_list(host):
hosts = service.expand_host(host[0])
def _calc_load(x):
return x / 65535
@coroutine
def _run():
rows = []
aps = yield service.create_multiple_ap(hosts)
details = yield service.ap_list(aps)
header_out('name, host, #clients, loadavg, mem, uptime')
for ap in details:
row = []
row.append(_val(ap, 'board.hostname'))
row.append(_val(ap, 'host'))
row.append('%s' % (_val(ap, 'num_clients')))
row.append('%.2f / %.2f / %.2f' % (
_val(ap, 'system.load.0', _calc_load),
_val(ap, 'system.load.1', _calc_load),
_val(ap, 'system.load.2', _calc_load)))
row.append('%s / %s' %
(_val(ap, 'system.memory.free', naturalsize),
_val(ap, 'system.memory.total', naturalsize)))
row.append('%s' % (_val(ap, 'system.uptime', naturaltime)))
rows.append(', '.join(row))
out('\n'.join(sorted(rows, cmp_host)))
IOLoop.instance().run_sync(_run)
评论列表
文章目录