[atlas] Introducing: the new result parsing library (Sagan)
- Previous message (by thread): [atlas] Introducing: the new result parsing library (Sagan)
- Next message (by thread): [atlas] Introducing: the new result parsing library (Sagan)
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stephane Bortzmeyer
bortzmeyer at nic.fr
Mon May 26 16:50:27 CEST 2014
On Mon, May 12, 2014 at 12:10:01PM +0200, dquinn <dquinn at ripe.net> wrote a message of 28 lines which said: > The idea is that you run every result you get through this handy > Python library and out comes programmer-friendly Python objects. It > supports the various changes in result format over time, and even > does some of the heavy lifting for you like calculating ping median > rtt, parsing the DNS abuf, or counting the traceroute hops. Unfortunately, it seems it have been made for brains brighter than mine. I tried the following script: import sys from ripe.atlas.sagan import PingResult if len(sys.argv) <= 1: raise Exception("Usage: %s filename ..." % sys.argv[0]) for filename in sys.argv[1:]: results = open(filename).read() result = PingResult(results) print filename print result.rtt_median print "" And I give it the result of a measurement (#1666654 if you want to check): Traceback (most recent call last): File "sagan-ping.py", line 19, in <module> result = PingResult(results) File "/usr/local/lib/python2.7/dist-packages/ripe.atlas.sagan-0.1.14-py2.7.egg/ripe/atlas/sagan/ping.py", line 54, in __init__ Result.__init__(self, data, **kwargs) File "/usr/local/lib/python2.7/dist-packages/ripe.atlas.sagan-0.1.14-py2.7.egg/ripe/atlas/sagan/base.py", line 118, in __init__ "measurement: {raw_data}".format(raw_data=self.raw_data)) ripe.atlas.sagan.base.ResultParseError: This does not look like a RIPE Atlas measurement: [{u'af': 6, u'prb_id': 10031, u'result': [{u'rtt': 56.194}, {u'rtt': 54.074}, {u'rtt': 54.47}], u'ttl': 54, u'avg': 54.9126666667, u'size': 48, u'from': u'2a01:1e8:e13f:0:a2f3:c1ff:fec4:5fab', u'proto': u'ICMP', u'timestamp': 1401114806, u'dup': 0, u'type': u'ping', u'sent': 3, u'msm_id': 1666654, u'fw': 4610, u'max': 56.194, u'step': None, u'src_addr': u'2a01:1e8:e13f:0:a2f3:c1ff:fec4:5fab', u'rcvd': 3, u'msm_name': u'Ping', u'lts': 16, u'dst_name': u'2001:4b98:dc0:41:216:3eff:fece:1902', u'min': 54.074, u'group_id': 1666654, u'dst_addr': u'2001:4b98:dc0 [...] The JSON file (attached) does seem correct. I also tried with pre-parsing: for filename in sys.argv[1:]: results = json.loads(open(filename).read()) result = PingResult(results) print filename and got the same result.
- Previous message (by thread): [atlas] Introducing: the new result parsing library (Sagan)
- Next message (by thread): [atlas] Introducing: the new result parsing library (Sagan)
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]