示例#1
0
def host_online(host):
    t1 = time.time()
    while True:
        if ping_ok(host):
            break

        if (time.time() - t1) > PING_TIMEOUT:
            DWARN("host %s ping error" % (host))
            return False

        DWARN("host %s ping lost, retry" % (host))
        time.sleep(1)

    return True
示例#2
0
文件: agent.py 项目: zhangzz2/vmcheck
    def _ping():
        while True:
            item = None
            try:
                item = q.get(block=False)
            except Queue.Empty, e:
                break

            if ping_ok(item):
                ok.append(item)
            else:
                error.append(item)

            q.task_done()
示例#3
0
def host_online(host):
    t1 = time.time()
    while True:
        if ping_ok(host):
            break

        if (time.time() - t1) > PING_TIMEOUT:
            DWARN("host %s ping error" % (host))
            return False

        DWARN("host %s ping lost, retry" % (host))
        time.sleep(1)

    return True