RIPE Atlas JSON traceroutes
Hi, has anyone written or found a tool to convert JSON output to a more human readable format, like traditional traceroute? INPUT: { "from": "80.123.123.123", "fw": 1, "msm_id": 1234567, "prb_id": 12345, "result": "traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets NEWLINE 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms NEWLINE 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms NEWLINE", "timestamp": 1234567890 }, OUTPUT: traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms etc. I'm hopeless as a programmer, otherwise I would have written something myself... Best regards, Paul Hoogsteder
On 19/04/2012 13:08, Paul Hoogsteder wrote:
Hi,
has anyone written or found a tool to convert JSON output to a more human readable format, like traditional traceroute?
I'm using perl-script like this for that: call like <scriptname> <udmlog-file> ---- #!/usr/bin/env perl use strict; use warnings; use JSON::Syck qw(LoadFile); my $j = LoadFile( $ARGV[0] ) or die; foreach my $msm (@$j) { my $traceroute = $msm->{result}; $traceroute =~ s/NEWLINE/\n/g; print $traceroute; } --- (requires JSON::Syck installed, typically 'sudo cpan JSON::Syck' should get that installed for you on the system you run this on). Emile
INPUT:
{ "from": "80.123.123.123", "fw": 1, "msm_id": 1234567, "prb_id": 12345, "result": "traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets NEWLINE 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms NEWLINE 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms NEWLINE", "timestamp": 1234567890 },
OUTPUT:
traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms etc.
I'm hopeless as a programmer, otherwise I would have written something myself...
Best regards,
Paul Hoogsteder
In your letter dated Thu, 19 Apr 2012 13:08:40 +0200 you wrote:
has anyone written or found a tool to convert JSON output to a more human readable format, like traditional traceroute?
INPUT:
{ "from": "80.123.123.123", "fw": 1, "msm_id": 1234567, "prb_id": 12345, "result": "traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets NEWLINE 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms NEWLINE 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms NEWLINE", "timestamp": 1234567890 },
OUTPUT:
traceroute to 91.228.151.2 (91.228.151.2), 30 hops max, 38 byte packets 1 192.168.123.123 2.087 ms 1.732 ms 1.928 ms 2 194.109.123.123 16.650 ms 16.570 ms 17.072 ms etc.
On some systems, like Linux, the following sed command provides useful results: cat output | sed 's/ *NEWLINE */\n/g'
participants (3)
-
Emile Aben
-
Paul Hoogsteder
-
Philip Homburg