Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mtr #127

Closed
jimaek opened this issue May 16, 2022 · 18 comments · Fixed by #138
Closed

Add mtr #127

jimaek opened this issue May 16, 2022 · 18 comments · Fixed by #138
Assignees

Comments

@jimaek
Copy link
Member

jimaek commented May 16, 2022

Example binary command:

mtr -4 -o "LDRAVM" --aslookup --show-ips --interval 0.5 --gracetime 3 --max-ttl 30 --timeout 15 -c 3 google.com
mtr -4 -o "LDRAVM" --aslookup --show-ips --interval 0.5 --gracetime 3 --max-ttl 30 --timeout 15 {--udp|--tcp} -c $PACKETS google.com
  1. Output is a bit different from traceroute. It opens a new window basically and then exits. So to have real-time results we need to read the new window.
  2. We also need to remove the first 3 lines of output (if it didnt fail with an error)
  3. Not sure how to detect it finished. Maybe check for an exit code, it seems to return 0 when it finished without errors? echo $?
  • packets {6} - The number of packets to send. max 16. Default is 3 (optional)
  • protocol {TCP} - Mtr protocol. ICMP|TCP|UDP. Default is ICMP (optional)
  • port {90} - Port to use if TCP or UDP is selected above. Default 80 (optional)
@patrykcieszkowski
Copy link
Contributor

I'm not sure if that's gonna be a problem, but seems worth mentioning:

mtr: non-root users cannot request an interval < 1.0 seconds

@jimaek
Copy link
Member Author

jimaek commented May 16, 2022

Yeah, it should be fine inside our containers :) But let me know if something unexpected comes up

@patrykcieszkowski
Copy link
Contributor

another note:
flag -r runs MTR in stdout

@jimaek
Copy link
Member Author

jimaek commented May 16, 2022

It also makes it not-real time :(

@patrykcieszkowski
Copy link
Contributor

patrykcieszkowski commented May 24, 2022

What should we do with MTR's ASCI color characters? They polute the output, to the point it makes it unreadable. Naturally, we gotta get rid of them for the parsed output, but should we keep them for the rawOutput?

{
  rawOutput: '\x1B(B\x1B)0\x1B[?1049h\x1B[1;24r\x1B[m\x0F\x1B[4l\x1B[39;49m\x1B[39;49m\x1B[m\x0F\x1B[H\x1B[J\x1B[1;29H\x1B[0;1m\x0F\x1B[1K My traceroute  [v0.93]\r\n' +
    '\x1B[m\x0Fdev-serv (192.168.0.16)\x1B[2;56H2022-05-24T19:21:42+0000\r\n' +
    'Keys:  \x1B[0;1m\x0FH\x1B[m\x0Felp   \x1B[0;1m\x0FD\x1B[m\x0Fisplay mode   \x1B[0;1m\x0FR\x1B[m\x0Festart statistics   \x1B[0;1m\x0FO\x1B[m\x0Frder of fields   \x1B[0;1m\x0Fq\x1B[m\x0Fuit\x1B[4;46H\x1B[0;1m\x0F   Packets               Pings\r\n' +
    ' Host\x1B[5;46H Loss% Drop   Rcv   Avg StDev Javg\r\x1BM\x1BM\x1B[m\x0F\n' +
    '\n' +
    '\n' +
    ' 1. AS???    192.168.0.1 (192.168.0.1)\x1B[6;48H0.0%    0     1   2.1   0.0  0.0\r\n' +
    ' 2. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1B[8d 3. AS5089   62.252.67.181 (62.252.67.181)     0.0%    0     1  18.4   0.0  0.0\r\n' +
    ' 4. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1B[8;14Hlutn-core-2a-xe-7114-0.network.v\x1B[H\n' +
    '\n' +
    '\x1B[10d 5. AS5089   62.254.59.130 (62.254.59.130)     0.0%    0     1  10.9   0.0  0.0\r\n' +
    ' 6. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1B[10;14Heislou2-ic-4-ae0-0.network.virgi\x1B[H\n' +
    '\n' +
    '\x1B[11;5HAS15169  142.250.160.116 (142.250.160.116  0.0%    0     1  12.7   0.0  0.0\r\n' +
    ' 7. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1B[12;5HAS15169  216.239.41.149 (216.239.41.149)   0.0%    0     1  14.5   0.0  0.0\r\n' +
    ' 8. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1B[13;5HAS15169  142.251.52.149 (142.251.52.149)   0.0%    0     1  26.4   0.0  0.0\r\n' +
    ' 9. \x1B[0;1m\x0F(waiting for reply)\x1B[H\n' +
    '\n' +
    '\x1B[m\x0F\x1BM\x1B[74G3\x1B[14;5HAS15169  172.217.16.238 (172.217.16.238)   0.0%    0     1  10.4   0.0  0.0\x1B[H\n' +
    '\n' +
    '\x1B[14;14Hmad08s04-in-f14.1e100.net (172.2\x1B[H\n' +
    '\n' +
    '\x1BM\x1B[74G4\r\n' +
    '\x1BM\x1B[74G5\r\n' +
    '\x1BM\x1B[74G6\r\n' +
    '\x1B[24;1H\x1B[?1049l\r\x1B[?1l\x1B>'
}

@jimaek
Copy link
Member Author

jimaek commented May 24, 2022

definitely no, the question is if we need to do this manually or there is an option to disable it

@patrykcieszkowski
Copy link
Contributor

I can easily filter them out with single regex query, that's not an issue. I just wasn't sure if we want to manipulate the rawOutput at all.

@jimaek
Copy link
Member Author

jimaek commented May 24, 2022

There is no value in keeping the colors and it will make the life easier for many people if its regular readable text. So lets remove it :)

@patrykcieszkowski patrykcieszkowski mentioned this issue Jun 2, 2022
4 tasks
@jimaek jimaek reopened this Jun 14, 2022
@jimaek
Copy link
Member Author

jimaek commented Jun 14, 2022

  • Most rows return (waiting for reply) instead of the result. While the mtr command has them every time
  • ASNs are sometimes missing, but not via mtr
  • Last line is sometimes duplicated
  • Metadata should round the numbers "jMin": 0.15600000000000003,

@patrykcieszkowski
Copy link
Contributor

patrykcieszkowski commented Jun 15, 2022

  • Most rows return (waiting for reply) instead of the result. While the mtr command has them every time

It happened randomly, and was especially noticible on production probes - it didn't happen on my local dev serv. If I'm right, it was caused by the fact we have to asynchroniously query ASN values, while we tried to keep progress events going, so we ended up overriding the result. Fixed.

  • ASNs are sometimes missing, but not via mtr

fixed.

  • Last line is sometimes duplicated

True, but not true. Some routes point to the same server, and MTR responds with... new routes under the same address. MTR in UI mode merges them together (i think?), but that doesn't seem right since they are seperate routes.

Here's an example on jsdelivr.com response. Look at lines starting with h 9 and h 10. h represents host type, and numbers route index. The IP is duplicated. (ignore duplication in tags)
https://gist.github.com/patrykcieszkowski/d49d0574fa76ad5497d7eb42323c5365

I added a list of raw outputs to the measurement response, so we can debug it. We might delete or keep it later.

  • Metadata should round the numbers "jMin": 0.15600000000000003,

done.

jsdelivr/globalping-probe#58

@patrykcieszkowski
Copy link
Contributor

Here's another example of this duplication on google.com domain. Except this time, one of them comes with a resolved hostname.

https://gist.github.com/patrykcieszkowski/9afa8a01456096ccfd27dc924e992424

@jimaek
Copy link
Member Author

jimaek commented Jun 15, 2022

Another issue with private IPs when running mtr to google.com

{
  "id": "4rrYZPmmhTJo4sVf",
  "type": "mtr",
  "status": "finished",
  "createdAt": 1655313809031,
  "updatedAt": 1655313810260,
  "results": [
    {
      "probe": {
        "continent": "SA",
        "region": "southern america",
        "country": "EC",
        "state": null,
        "city": "guayaquil",
        "asn": 14522,
        "longitude": -79.8862,
        "latitude": -2.1962,
        "network": "satnet"
      },
      "result": {
        "hops": [],
        "rawOutput": "Private IP ranges are not allowed",
        "data": [
          "x 0 33000",
          "h 0 186.68.104.129",
          "p 0 575 33000",
          "x 1 33001",
          "h 1 10.145.72.1",
          "p 1 5864 33001",
          "x 2 33002",
          "h 2 192.168.0.162",
          "p 2 6178 33002"
        ]
      }
    }
  ]
}
{
  "id": "ovhiEtEyoWfz9NLo",
  "type": "mtr",
  "status": "finished",
  "createdAt": 1655313912181,
  "updatedAt": 1655313912733,
  "results": [
    {
      "probe": {
        "continent": "NA",
        "region": "northern america",
        "country": "US",
        "state": "VA",
        "city": "ashburn",
        "asn": 14618,
        "longitude": -77.4875,
        "latitude": 39.0437,
        "network": "amazon.com"
      },
      "result": {
        "hops": [],
        "rawOutput": "Private IP ranges are not allowed",
        "data": [
          "x 0 33000",
          "h 0 216.182.238.245",
          "p 0 1160 33000",
          "x 1 33001",
          "x 2 33002",
          "x 3 33003",
          "x 4 33004",
          "h 4 241.0.12.7",
          "p 4 373 33004"
        ]
      }
    }
  ]
}

@jimaek
Copy link
Member Author

jimaek commented Jun 20, 2022

Current state:

  • Duplication bug when tests end with (waiting for reply)
  • Weird behavior when testing IPs like 1.1.1.1 and 8.8.8.8

@jimaek
Copy link
Member Author

jimaek commented Jun 23, 2022

Some tests are randomly broken:

{
  "id": "qJYx6a573nNUGn1O",
  "type": "mtr",
  "status": "finished",
  "createdAt": 1656003058895,
  "updatedAt": 1656003059366,
  "results": [
    {
      "probe": {
        "continent": "EU",
        "region": "northern europe",
        "country": "FI",
        "state": null,
        "city": "helsinki",
        "asn": 24940,
        "longitude": 24.93,
        "latitude": 60.17,
        "network": "hetzner online gmbh"
      },
      "result": {
        "hops": [],
        "rawOutput": "Host                            Loss% Drop Rcv Avg  StDev  Javg \n1. AS???   _gateway (172.31.1.1)    0.0%    0   0 2.1    0.0   2.1\n2. AS24940 65.108.112.232 (65.108.112.232)    0.0%    0   0 0.3    0.0   0.3\n3. AS???   (waiting for reply) \n4. AS24940 88.198.244.241 (88.198.244.241)    0.0%    0   0 5.8    0.0   5.8\n5. AS24940 88.198.249.89 (88.198.249.89)    0.0%    0   0 0.6    0.0   0.6\n6. AS24940 213.239.224.37 (213.239.224.37)    0.0%    0   0 0.6    0.0   0.6\n7. AS???   (waiting for reply) \n",
        "data": []
      }
    }
  ]
}

Host                            Loss% Drop Rcv Avg  StDev  Javg 
1. AS???   _gateway (172.31.1.1)    0.0%    0   0 2.1    0.0   2.1
2. AS24940 65.108.112.232 (65.108.112.232)    0.0%    0   0 0.3    0.0   0.3
3. AS???   (waiting for reply) 
4. AS24940 88.198.244.241 (88.198.244.241)    0.0%    0   0 5.8    0.0   5.8
5. AS24940 88.198.249.89 (88.198.249.89)    0.0%    0   0 0.6    0.0   0.6
6. AS24940 213.239.224.37 (213.239.224.37)    0.0%    0   0 0.6    0.0   0.6
7. AS???   (waiting for reply)

Also need to test cases when the endpoint doesnt resolve correctly.

@patrykcieszkowski
Copy link
Contributor

I believe this issue is now resolved. Have you noticed anything else wrong with MTR cmd?

@jimaek
Copy link
Member Author

jimaek commented Jul 26, 2022

It looks good to me, but given the many edge-cases we encountered how about @MartinKolarik @ayuhito you also test our mtr?
To make sure it works properly. Maybe spend 10 minutes on it just in case

@patrykcieszkowski
Copy link
Contributor

btw I don't think we've released any new probe version, and we changed a lot in the input, response schema etc. Maybe we should do it before testing anything.

@jimaek
Copy link
Member Author

jimaek commented Jul 26, 2022

Everything was merged and deployed. You can now all test again MTR and maybe even the rest of the commands too to make sure the latest changes didn't break anything.

@jimaek jimaek closed this as completed Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants