Page MenuHomeVyOS Platform

Machine-readable operational mode support for traceroute
In progress, NormalPublic

Description

Right now, the operational mode traceroute command is a wrapper for the classic UNIX traceroute(8). That's good for interactive use but there's no machine-readable commands that could be used through the API.

mtr supports JSON output out of the box in recent Debian versions. For example:

vyos@vyos# mtr -r -c 1 -j 192.168.1.254 | jq
{
  "report": {
    "mtr": {
      "src": "vyos",
      "dst": "192.168.1.254",
      "tos": 0,
      "tests": 1,
      "psize": "64",
      "bitpattern": "0x00"
    },
    "hubs": [
      {
        "count": 1,
        "host": "10.0.3.2",
        "Loss%": 0,
        "Snt": 1,
        "Last": 0.268,
        "Avg": 0.268,
        "Best": 0.268,
        "Wrst": 0.268,
        "StDev": 0
      },
      {
        "count": 2,
        "host": "192.168.1.254",
        "Loss%": 0,
        "Snt": 1,
        "Last": 8.702,
        "Avg": 8.702,
        "Best": 8.702,
        "Wrst": 8.702,
        "StDev": 0
      }
    ]
  }
}

I'm not sure if we should replace interactive traceroute with mtr as well, since it will change the familiar output, and mtr's report mode feels slow because it collects the data first. But we can certainly add it a machine-readable endpoint and use mtr for it.

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)