From 1eddbfe6e813746da529250b280b2af7bc943dde Mon Sep 17 00:00:00 2001 From: ubuntu <ubuntu@ubuntu.com> Date: Thu, 30 Aug 2018 11:20:36 +0800 Subject: [PATCH] fix a show PinglostRate bug --- clients/client-linux.py | 5 +---- clients/client-psutil.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/clients/client-linux.py b/clients/client-linux.py index af23c85..77793c4 100755 --- a/clients/client-linux.py +++ b/clients/client-linux.py @@ -174,10 +174,7 @@ def _ping_thread(host, mark): if 'ttl' not in buffer: lostCount += 1 allCount += 1 - # 防止吓人 - if allCount < 100: - lostRate[mark] = 0.00 - else: + if allCount > 100: lostRate[mark] = float(lostCount) / allCount endTime = time.time() if endTime-startTime > 3600: diff --git a/clients/client-psutil.py b/clients/client-psutil.py index 194bef0..b552774 100755 --- a/clients/client-psutil.py +++ b/clients/client-psutil.py @@ -143,10 +143,7 @@ def _ping_thread(host, mark): if 'TTL' not in buffer.upper(): lostCount += 1 allCount += 1 - # 防止吓人 - if allCount < 100: - lostRate[mark] = 0.00 - else: + if allCount > 100: lostRate[mark] = float(lostCount) / allCount endTime = time.time() if endTime-startTime > 3600: