如何在输出fi中保存Iperf结果

2024-04-23 19:57:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我在一组从txt文件读取的主机之间运行iperf,下面是我运行它的方法:

h1,h2 = net.getNodeByName(node_id_1, node_id_2)

net.iperf((h1, h2))

它运行良好并显示结果。但是,我想将iperf结果的输出保存在一个单独的txt文件中。有人知道我如何把它应用到上面的代码上吗?


Tags: 文件方法代码txtidnodeneth2
3条回答

为了将iperf测试的结果存储在文件中,请在命令行中添加| tee和filename.txt,例如:

iperf-c ipaddress-u-t 10-i 1 | tee result.txt

你已经试过了吗:

--output test.log

(在较新版本中--logfile

或使用

youriperfexpr > test.log

我也有这个问题。尽管手册页指定“-o”或“-output”将输出保存到文件中,但这实际上不起作用。

似乎这被标记为“WontFix”: https://code.google.com/p/iperf/issues/detail?id=24

Looks like -o/--output existed in a previous version but in not in the current version. The consensus in yesterday's meeting was that if --output existed then we should fix it, otherwise people should just use shell redirection and we'll mark this WontFix. So, WontFix.

因此,可以按照Paolo的建议使用typescript或“>;test.log”

相关问题 更多 >