mtr-exporter: MTR Exporter returns no metrics when Max TTL is reached

When a host is not reachable due to very long routing(max 30 hops), often seen in VPN networks, but not exclusively:

 > traceroute 100.100.100.100         
traceroute to 100.100.100.100 (100.100.100.100), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
...
29  * * *
30  * * *

MTR returns a very sparse response with hubs being an empty list, and provides no failure exit code:

 > mtr -j -c2 100.100.100.100             
{
    "report": {
        "mtr": {
            "src": "example-host",
            "dst": "100.100.100.100",
            "tos": 0,
            "tests": 2,
            "psize": "64",
            "bitpattern": "0x00"
        },
        "hubs": []
    }
}

Which results in mtr-exporter returning no metrics for the defined job. This means no alerts can be created for such a failure mode.

While this is understandable for other metrics even mtr_report_count_hubs does not show up with value of 0, it simply does not exist.

In a perfect world mtr_report_loss would also return 100% packet loss, but I understand that would have to be a manufactured metric, since it couldn’t be generated from hubs from the mtr response, but would be the more correct thing to do.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (20 by maintainers)

Most upvoted comments

@jakubgs

While this is understandable for other metrics even mtr_report_count_hubs does not show up with value of 0, it simply does not exist.

I am looking at the code:

Isn’t that your case?

In a perfect world mtr_report_loss would also return 100% packet loss, but I understand that would have to be a manufactured metric, since it couldn’t be generated from hubs from the mtr response, but would be the more correct thing to do.

I can imagine a mtr_report_min_loss which is by default set to 100% and then picking the smallest available loss number from the available hubs. 0 hubs -> 100%, at least 1 regular hub -> a value way below 100%. Could work.

If you are in the mood: try #34

Thank you, that’s amazing. Appreciate your fast responses man. I love this software.

@jakubgs I released mtr-exporter:0.6.0, it includes mtr_report_min_loss.

@jakubgs Yes. Or … I mean, we know:

  • -m N defines the maximum hops
  • if the last entry in the results is the destination, then mtr finished as intended
  • if the last entry is not the destion, mtr probed up to -m N: it sends a packet, no answer -> ttl increase -> retry -> no answer.

Mhh. The “bug” / area to improve in mtr itself is not so much that it can’t say “I reached IP a.b.c.d”. It should just state in the result the -m N value:

mtr --json -m 2 -n -c 1 9.9.9.9   
{
    "report": {
        "mtr": {
            "src": "src-host",
            "dst": "9.9.9.9",
            "tos": 0,
            "tests": 1,
            "psize": "64",
            "bitpattern": "0x00"
        },
        "hubs": [
            {
                "count": 1,
                "host": "192.168.1.1",
                "Loss%": 0.0,
                "Snt": 1,
                "Last": 14.914,
                "Avg": 14.914,
                "Best": 14.914,
                "Wrst": 14.914,
                "StDev": 0.0
            },
            {
                "count": 2,
                "host": "192.168.2.1",
                "Loss%": 0.0,
                "Snt": 1,
                "Last": 8.163,
                "Avg": 8.163,
                "Best": 8.163,
                "Wrst": 8.163,
                "StDev": 0.0
            }
        ]
    }
}

The mtr object in the report should contain that maximum TTL. And then I can built something around that.

What if you just fake mtr_report_count_hubs with value set to 0 for the case where hops key is an empty list?

Yes, doable.

Darn.

Maybe time for a social-engineering competition thingy 😃 You create also a bug on trippy and see which one delivers first =)

@jakubgs Yah, any indication on which … hops were checked or an indication of “tried with ttl of 1: nothing, tried 2: nothing, tried 3: yeah, here some numbers” and encoded into JSON or alike, then I can work with that.

Lets see the decision over at mtr.

In the meantime: https://github.com/mgumz/speedtest-exporter needs an beta-tester =)

Pretty sure, for example google.com is available for me after 9 hops, out of which first 4 are non-discoverable.

So if I use --max-ttl 4 I get nothing in hubs:

 > mtr -m4 -c1 -j google.com
{
    "report": {
        "mtr": {
            "src": "caspair",
            "dst": "google.com",
            "tos": 0,
            "tests": 1,
            "psize": "64",
            "bitpattern": "0x00"
        },
        "hubs": []
    }
}

But if I increase it to 5 I get something:

 > mtr -m5 -c1 -j google.com
{
    "report": {
        "mtr": {
            "src": "caspair",
            "dst": "google.com",
            "tos": 0,
            "tests": 1,
            "psize": "64",
            "bitpattern": "0x00"
        },
        "hubs": [
            {
                "count": 1,
                "host": "_gateway",
                "Loss%": 0.0,
                "Snt": 1,
                "Last": 0.351,
                "Avg": 0.351,
                "Best": 0.351,
                "Wrst": 0.351,
                "StDev": 0.0
            },
            {
                "count": 2,
                "host": "???",
                "Loss%": 100.0,
                "Snt": 1,
                "Last": 0.0,
                "Avg": 0.0,
                "Best": 0.0,
                "Wrst": 0.0,
                "StDev": 0.0
            }
        ]
    }
}

Since the 5th hop responds.

I believe this is at least partially an MTR bug, because it returns no failure exit code, so I opened an issue: