Bash

mtr 原始輸出的格式是什麼?

  • July 27, 2021

我使用 mtr 來計算主機的跳數並將該數字傳遞給腳本。我發現-l(或--raw)選項可以生成可供解析的輸出。但是,我想知道在哪裡可以找到這個原始格式描述?不幸的是,manGoogle只給我這個:

-l

  --raw
         Use  this option to tell mtr to use the raw output format. This format is better suited for archival of the measure‐
         ment results. It could be parsed to be presented into any of the other display methods.

在他們的源文件中,MTR 的文件名為:FORMATS

來源

該文件的摘錄是:

The "raw" format is:

hostline|xmitline|pingline|dnsline|timestampline|mplsline

hostline:
h <pos> <host IP>

xmitline:
x <pos> <seqnum>

pingline:
p <pos> <pingtime (ms)> <seqnum>

dnsline: 
d <pos> <hostname>

timestampline:
t <pos> <pingtime> <timestamp>

mplsline:
m <pos> <label> <traffic_class> <bottom_stack> <ttl>

解析時,此 <pos> 是主機索引的整數。第一跳的主機將是 0,第二跳是 1,等等。還需要注意的是,pingtime 以毫秒為單位,但以微秒為單位,而不是毫秒。

引用自:https://serverfault.com/questions/540056