Giter VIP home page Giter VIP logo

mtr's Introduction

MTR

Build Status

A MTR implementation written in golang, completely without shell-execs.

Just install with the following command:

go get -u github.com/tonobo/mtr
sudo setcap cap_net_raw+ep PATH-TO-GOMTR

or a precompiled version

curl -sL git.io/mtr.sh | sh -s -- -b /usr/local/bin && sudo setcap cap_net_raw+ep /usr/local/bin/mtr

Note: This tool maybe called with sudo or as root, because it requires raw sockets.

Output

Currently there is no support for non ipv4 targets

HOP:    Address                Loss%  Sent    Last     Avg    Best   Worst       Packets
  1:|-- 10.200.1.1              0.0%     6     1.4     1.8     1.2     3.2         .....
  2:|-- 192.168.2.1             0.0%     6     3.3     3.1     2.4     3.5         .....
  3:|-- 62.155.247.163          0.0%     6    10.9    11.6    10.9    12.6         .....
  4:|-- 217.5.95.170            0.0%     6    24.5    24.9    24.5    26.0         .....
  5:|-- 72.14.194.156           0.0%     6    23.9    25.1    23.2    30.4         .....
  6:|-- ???                   100.0%     6     0.0     0.0     0.0     0.0         ?????
  7:|-- 209.85.142.128          0.0%     6    24.5    24.9    23.6    25.8         .....
  8:|-- 108.170.227.227         0.0%     6    25.4    25.6    24.0    30.0         .....
  9:|-- 8.8.8.8                 0.0%     5    23.9    24.2    23.6    25.0          ....

JSON:

{
  "destination": "8.8.8.8",
  "statistic": {
    "1": {
      "avg_ms": 1.3946096666666667,
      "best_ms": 1.3157679999999998,
      "last_ms": 1.322044,
      "loss_percent": 0,
      "packet_buffer_size": 10,
      "packet_list_ms": [
        {
          "respond_ms": 1.322044,
          "success": true
        },
        {
          "respond_ms": 1.3157679999999998,
          "success": true
        },
        {
          "respond_ms": 1.546017,
          "success": true
        },
        null,
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "sent": 3,
      "target": "10.200.1.1",
      "ttl": 1,
      "worst_ms": 1.546017
    },
    "2": {
      // ...
    }
  }
}

Usage

Usage:
  mtr TARGET [flags]

Flags:
      --buffer-size int     Cached packet buffer size (default 50)
  -c, --count int           Amount of pings per target (default 5)
  -h, --help                help for mtr
  -i, --interval duration   Wait time between icmp packets before sending new one (default 100ms)
      --json                Print json results
      --max-hops int        Maximal TTL count (default 64)
  -t, --timeout duration    ICMP reply timeout (default 800ms)

mtr's People

Contributors

sgtdajim avatar sj14 avatar tonobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mtr's Issues

Licence?

Hey, I plan to use this project in an (open source) project of mine so I can run something like MTR without having C dependencies. You have done a great job!

I have noticed there is no license file nor is it mentioned in the readme, would you mind adding a license so I can make sure I credit your work correctly. Thanks!

Many duplicate routes ip, loop show?

image

Using linux's MTR is inconsistent with the result of this time. It should be that there is something wrong with the program, but I did not find it out.

Project Maintenance / Ownership

Hi, this project fits a use-case I have, but I'd want to make a few changes to import it as a client lib rather than using it as a CLI.

I see there hasn't been much activity for a few years, and there's an open PR: #23

Is this project still being maintained? The Grafana fork appears to be the most up-to-date, so I'm wondering if I should fork off https://github.com/grafana/mtr, or if there's any chances of this main fork seeing activity in future?

Excess TTL data appears during operation due to ping timeout.

ttl 13 and ttl 14 has same target ip address.

Because during the detection process, after the ping times out, the ttl counter will continue to increase until the ping succeeds. This leads to redundant ttl data in the final result.

image

This situation always occurs when packet loss occurs.

Shows packet loss where the original mtr doesn't

The first packet behind the following node is still marked as successfully sent, but after that all further packets are marked as lost.

5:|-- ??? 100.0% 1 0.0 0.0 0.0 0.0 ?

The original mtr tool shows no packet loss here.

Error: GetWinsize: inappropriate ioctl for device

Getting this error on a MIPS based device.

root@localhost:/usr/bin# gomtr 1.1.1.1
Start: 2019-02-20 19:24:20.633342142 +0000 UTC m=+0.019848589
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device
Error: GetWinsize: inappropriate ioctl for device

Think this was fixed in this patch:

buger/goterm@2f70ee4

Edit:

I can confirm that updating buger/goterm and golang.org/x/sys/unix fixes the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.