cmd.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:openwrt-wac 作者: jianingy 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号