大网数据广告活动
服务器运维问答

What is the format of mtr raw output?

· 52CE 我爱测

I use mtr to count number of hops to a host and pass that number to a script. I discovered -l (or --raw ) option which produces an output ready for parsing. However, I'd like to know where to find this raw format description? Unf…

问题原文

原帖链接 · gluk47 · CC BY-SA 3.0

I use mtr to count number of hops to a host and pass that number to a script. I discovered -l (or --raw) option which produces an output ready for parsing. However, I'd like to know where to find this raw format description? Unfortunately, man and google give me only this:

-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.

已采纳解答

原帖链接 · Danila Ladner · CC BY-SA 4.0

In their source files MTR has file named: FORMATS

source

From that file is the excerpt:

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>

When parsing this <pos> is an integer for the index of the host. The host at the first hop will be 0, second hop 1, etc. It should also be noted that pingtime is in ms, but microseconds and not miliseconds.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-09-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。