fixing bugs

This commit is contained in:
mantaohuang 2020-04-05 18:34:00 -04:00
parent de24de6913
commit 0d68c67697

View File

@ -160,9 +160,10 @@ class Openvpn:
assert self.interface in io_count, "cannot find interface, nic is not there" assert self.interface in io_count, "cannot find interface, nic is not there"
io_count = io_count[self.interface] io_count = io_count[self.interface]
open(self.io_stat_fp, "a").write( open(self.io_stat_fp, "a").write(
f"{datetime.utcnow().timestamp()},{io_count.bytes_recv},{io_count.bytes_recv}\n") f"{datetime.utcnow().timestamp()},{io_count.bytes_recv},{io_count.bytes_sent}\n")
#command = ["ping", "-w", "1", "-c", "1", "8.8.8.8"] #command = ["ping", "-w", "1", "-c", "1", "8.8.8.8"]
command = ["fping", "-C", "1", "-t200", "-q", "8.8.8.8"] command = ["fping", "-C", "1", "-t200",
"-I", self.interface, "-q", "8.8.8.8"]
p = subprocess.Popen( p = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.communicate() result = p.communicate()