health_check.py 文件源码

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

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def get_node_state(node):
    status = {}
    if node.get('status') == NODE_STATUSES.pending:
        status[NODE_STATUSES.pending] = False
        return status
    hostname = node['hostname']
    status[NODE_STATUSES.running] = node.get('status') == NODE_STATUSES.running
    env.host_string = hostname
    try:
        status['ntp'] = False
        status['services'] = False
        # AC-3105 Fix. Check if master can connect to node via ssh.
        if can_ssh_to_host(hostname):
            rv = run('ntpstat', quiet=True, timeout=SSH_TIMEOUT)
            if rv.succeeded:
                status['ntp'] = True
            status['ssh'] = True
            stopped = get_stopped_services(node_services, local=False)
            status['services'] = stopped if stopped else True
            status['disk'] = check_disk_space(local=False)
        else:
            status['ssh'] = False
    except (NetworkError, CommandTimeout):
        status['ssh'] = False
    return status
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号