예제 #1
0
    def report(self, detail):
        """
	Output a report on the collected statistics
	The 'detail' argument controls how much detail is provided
	(more detail, longer reports)
	"""

        if not self.aggregationDone:
            # aggregate the per probe results before reporting
            self.aggregateProbeData()

        host = dnsnamelookup(self.dst_addr)
        nprobes = len(self.probeReport.keys())
        if (detail == 0):
            if host:
                print "Destination:", self.dst_addr, " / ", host
            else:
                print "Destination:", self.dst_addr
        else:
            print "Destination:", self.dst_addr
            if host:
                print "Reverse DNS:", host

        print "Timeinterval:", time.strftime(
            "%Y-%m-%dT%H:%MZ",
            time.gmtime(self.starttime)), " - ", time.strftime(
                "%Y-%m-%dT%H:%MZ", time.gmtime(self.endtime))
        print "Number of samples:  ", self.samples
        print

        return
예제 #2
0
    def report(self, detail):
        """
	Output a report on the collected statistics
	The 'detail' argument controls how much detail is provided
	(more detail, longer reports)
	"""

        if not self.aggregationDone:
            # aggregate the per probe results before reporting
            self.aggregateProbeData()

        host = dnsnamelookup(self.dst_addr)
        nprobes = len(self.probeReport.keys())
        if (detail == 0):
            if host:
                print "Destination:", self.dst_addr, " / ", host
            else:
                print "Destination:", self.dst_addr
        else:
            print "Destination:", self.dst_addr
            if host:
                print "Reverse DNS:", host

        print "Timeinterval:", time.strftime(
            "%Y-%m-%dT%H:%MZ",
            time.gmtime(self.starttime)), " - ", time.strftime(
                "%Y-%m-%dT%H:%MZ", time.gmtime(self.endtime))
        print "Number of traces:", self.samples
        print "Number of unique routing vectors:", self.ipvectors
        print "Traces reaching target IP address: ", self.completetraces
        if (self.completetraces > 0):
            print "Average hop count: %.2f" % (float(self.totalhopcount) /
                                               self.completetraces)
        else:
            print "Average hop count:", "-"
        print "Traces not ending at target IP", self.destnotreached
        print
        print

        return
    def report(self,detail):
	"""
	Output a report on the collected statistics
	The 'detail' argument controls how much detail is provided
	(more detail, longer reports)
	"""

        if not self.aggregationDone:
	   # aggregate the per probe results before reporting
	   self.aggregateProbeData()

	host = dnsnamelookup(self.dst_addr)
	nprobes = len(self.probeReport.keys())
	if (detail==0):
	    if host:
		print "Destination:", self.dst_addr, " / " , host
	    else:
		print "Destination:", self.dst_addr
	else:
	    print "Destination:", self.dst_addr
	    if host:
		print "Reverse DNS:", host

	print "Timeinterval:" , time.strftime("%Y-%m-%dT%H:%MZ",time.gmtime(self.starttime)), " - ", time.strftime("%Y-%m-%dT%H:%MZ",time.gmtime(self.endtime))
	print "Number of traces:", self.samples
	print "Number of unique routing vectors:", self.ipvectors
	print "Traces reaching target IP address: ",self.completetraces
	if (self.completetraces > 0):
	    print "Average hop count: %.2f" % (float(self.totalhopcount)/self.completetraces)
	else:
	    print "Average hop count:", "-"
	print "Traces not ending at target IP",self.destnotreached
	print 
	print


	return
    def report(self,detail):
	"""
	Output a report on the collected statistics
	The 'detail' argument controls how much detail is provided
	(more detail, longer reports)
	"""

        if not self.aggregationDone:
	   # aggregate the per probe results before reporting
	   self.aggregateProbeData()

	# Look for reverse DNS (if any)
	host = dnsnamelookup(self.dst_addr)
	if (detail==0):
	    if host:
		print "Destination:", self.dst_addr, " / " , host
	    else:
		print "Destination:", self.dst_addr
	else:
	    print "Destination:", self.dst_addr
	    if host:
		print "Reverse DNS:", host


	nprobes = len(self.probeReport.keys())

	if (self.packets_sent>0):
    	    lost = 100 * (self.packets_sent - self.packets_rcvd)/float(self.packets_sent)
	    lost = "%.2f%%" % lost
	else:
    	    lost = "NA"
	    
	if (detail==0):
	    #minimal view; report median of the medians
	    if len(self.medianRtts) > 0:
	        numprobes = len(self.medianRtts) 
	        level500 = int(numprobes * 0.5)
                median = self.medianRtts[level500]
		median = "%.2fms" % median
	    else:
		median = "NA"
	    print "sent/received/loss/median %d/%d/%s/%s" % (self.packets_sent,self.packets_rcvd,lost,median)

	else:
	    print "Timeinterval:" , time.strftime("%Y-%m-%dT%H:%MZ",time.gmtime(self.starttime)), " - ", time.strftime("%Y-%m-%dT%H:%MZ",time.gmtime(self.endtime))
	    print "Packets sent:", self.packets_sent
	    print "Packets received:", self.packets_rcvd

	    print "Overall loss rate: %s" % lost
	    print
	    print "Total probes measuring: %6d" % nprobes
	    print "Probes with 100%% errors:%6d" % self.allerrors
	    if len(self.errorMsgs)>0:
	        print 'Total errors on probes: %6d' % sum(self.errorMsgs.values())
	        print 'Most common error:"%s (%dx)"' % sorted(self.errorMsgs.items(),key=lambda x: x[1], reverse=True)[0]
		
	    if (nprobes > 1):
	        print
	        print "Probes with no packets lost:   %6d" % self.lossless
	        print "Probes with 0%%-5%% loss:        %6d" % self.loss0
	        print "Probes with 5%%-20%% loss:       %6d" % self.loss5
	        print "Probes with 20%%-40%% loss:      %6d" % self.loss20
	        print "Probes with 40%%-60%% loss:      %6d" % self.loss40
	        print "Probes with 60%%-80%% loss:      %6d" % self.loss60
	        print "Probes with 80%%-100%% loss:     %6d" % self.loss80
	        print "Probes with 100%% loss:         %6d" % self.loss100
	        print "Probes not sending any packets:%6d" % self.nodata

	    print 
	    if len(self.medianRtts) > 0:
	        numprobes = len(self.medianRtts) 
	        level025 = int(numprobes * 0.025)
	        level250 = int(numprobes * 0.25)
	        level500 = int(numprobes * 0.5)
	        level750 = int(numprobes * 0.75)
	        level975 = int(numprobes * 0.975)
	        print "RTT distributions:"
	        print "-----------------\n"

	        print '2.5 percentile ("Minimum")'
	        print "lowest 2.5 percentile RTT in all probes:%8.2fms"  % self.minimumRtts[0]
	        print "2.5%% of probes had 2.5 percentile    <= %8.2fms" % self.minimumRtts[level025]
	        print "25%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level250])
	        print "50%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level500])
	        print "75%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level750])
	        print "97.5%% of probes had 2.5 percentile   <= %8.2fms" % (self.minimumRtts[level975])
	        print "highest 2.5 percentile in all probes    %8.2fms"  % (self.minimumRtts[numprobes-1])
	        print
	        print "Median"
	        print "lowest median RTT in all probes     %9.2fms"  % self.medianRtts[0]
	        print "2.5%% of probes had median RTT    <= %9.2fms" % self.medianRtts[level025]
	        print "25%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level250])
	        print "50%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level500])
	        print "75%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level750])
	        print "97.5%% of probes had median RTT   <= %9.2fms" % (self.medianRtts[level975])
	        print "highest median RTT in all probes    %9.2fms"  % (self.medianRtts[numprobes-1])
	        print
	        print '97.5 percentile ("Maximum")'
	        print "lowest 97.5 percentile RTT in all probes:%8.2fms"  % self.maximumRtts[0]
	        print "2.5%% of probes had 97.5 percentile    <= %8.2fms" % self.maximumRtts[level025]
	        print "25%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level250])
	        print "50%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level500])
	        print "75%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level750])
	        print "97.5%% of probes had 97.5 percentile   <= %8.2fms" % (self.maximumRtts[level975])
	        print "highest 97.5 percentile in all probes    %8.2fms"  % (self.maximumRtts[numprobes-1])
        print
	print


	return
    def report(self, detail):
        """
	Output a report on the collected statistics
	The 'detail' argument controls how much detail is provided
	(more detail, longer reports)
	"""

        if not self.aggregationDone:
            # aggregate the per probe results before reporting
            self.aggregateProbeData()

            # Look for reverse DNS (if any)
        host = dnsnamelookup(self.dst_addr)
        if detail == 0:
            if host:
                print "Destination:", self.dst_addr, " / ", host
            else:
                print "Destination:", self.dst_addr
        else:
            print "Destination:", self.dst_addr
            if host:
                print "Reverse DNS:", host

        nprobes = len(self.probeReport.keys())

        if self.packets_sent > 0:
            lost = 100 * (self.packets_sent - self.packets_rcvd) / float(self.packets_sent)
            lost = "%.2f%%" % lost
        else:
            lost = "NA"

        if detail == 0:
            # minimal view; report median of the medians
            if len(self.medianRtts) > 0:
                numprobes = len(self.medianRtts)
                level500 = int(numprobes * 0.5)
                median = self.medianRtts[level500]
                median = "%.2fms" % median
            else:
                median = "NA"
            print "sent/received/loss/median %d/%d/%s/%s" % (self.packets_sent, self.packets_rcvd, lost, median)

        else:
            print "Timeinterval:", time.strftime("%Y-%m-%dT%H:%MZ", time.gmtime(self.starttime)), " - ", time.strftime(
                "%Y-%m-%dT%H:%MZ", time.gmtime(self.endtime)
            )
            print "Packets sent:", self.packets_sent
            print "Packets received:", self.packets_rcvd

            print "Overall loss rate: %s" % lost
            print
            print "Total probes measuring: %6d" % nprobes
            print "Probes with 100%% errors:%6d" % self.allerrors
            if len(self.errorMsgs) > 0:
                print "Total errors on probes: %6d" % sum(self.errorMsgs.values())
                print 'Most common error:"%s (%dx)"' % sorted(self.errorMsgs.items(), key=lambda x: x[1], reverse=True)[
                    0
                ]

            if nprobes > 1:
                print
                print "Probes with no packets lost:   %6d" % self.lossless
                print "Probes with 0%%-5%% loss:        %6d" % self.loss0
                print "Probes with 5%%-20%% loss:       %6d" % self.loss5
                print "Probes with 20%%-40%% loss:      %6d" % self.loss20
                print "Probes with 40%%-60%% loss:      %6d" % self.loss40
                print "Probes with 60%%-80%% loss:      %6d" % self.loss60
                print "Probes with 80%%-100%% loss:     %6d" % self.loss80
                print "Probes with 100%% loss:         %6d" % self.loss100
                print "Probes not sending any packets:%6d" % self.nodata

            print
            if len(self.medianRtts) > 0:
                numprobes = len(self.medianRtts)
                level025 = int(numprobes * 0.025)
                level250 = int(numprobes * 0.25)
                level500 = int(numprobes * 0.5)
                level750 = int(numprobes * 0.75)
                level975 = int(numprobes * 0.975)
                print "RTT distributions:"
                print "-----------------\n"

                print '2.5 percentile ("Minimum")'
                print "lowest 2.5 percentile RTT in all probes:%8.2fms" % self.minimumRtts[0]
                print "2.5%% of probes had 2.5 percentile    <= %8.2fms" % self.minimumRtts[level025]
                print "25%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level250])
                print "50%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level500])
                print "75%% of probes had 2.5 percentile     <= %8.2fms" % (self.minimumRtts[level750])
                print "97.5%% of probes had 2.5 percentile   <= %8.2fms" % (self.minimumRtts[level975])
                print "highest 2.5 percentile in all probes    %8.2fms" % (self.minimumRtts[numprobes - 1])
                print
                print "Median"
                print "lowest median RTT in all probes     %9.2fms" % self.medianRtts[0]
                print "2.5%% of probes had median RTT    <= %9.2fms" % self.medianRtts[level025]
                print "25%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level250])
                print "50%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level500])
                print "75%% of probes had median RTT     <= %9.2fms" % (self.medianRtts[level750])
                print "97.5%% of probes had median RTT   <= %9.2fms" % (self.medianRtts[level975])
                print "highest median RTT in all probes    %9.2fms" % (self.medianRtts[numprobes - 1])
                print
                print '97.5 percentile ("Maximum")'
                print "lowest 97.5 percentile RTT in all probes:%8.2fms" % self.maximumRtts[0]
                print "2.5%% of probes had 97.5 percentile    <= %8.2fms" % self.maximumRtts[level025]
                print "25%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level250])
                print "50%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level500])
                print "75%% of probes had 97.5 percentile     <= %8.2fms" % (self.maximumRtts[level750])
                print "97.5%% of probes had 97.5 percentile   <= %8.2fms" % (self.maximumRtts[level975])
                print "highest 97.5 percentile in all probes    %8.2fms" % (self.maximumRtts[numprobes - 1])
        print
        print

        return