Ejemplo n.º 1
0
        stream.write('\n')
    for status,request in sorted(processor.status.items()):
        stream.write('{}\n'.format(status))
        for r in sorted(request):
            stream.write('\t{}\n'.format(r))


if __name__ == '__main__':
    import argparse
    import sys

    parser = argparse.ArgumentParser(description=__doc__, version=__version__)
    parser.add_argument(
        '-f', '--format', default='common',
        help='Log format string, or one of the predefined formats: {}'.format(
            ', '.join(sorted(_FORMATS.keys()))))
    for processor in sorted(PROCESSORS.keys()):
        parser.add_argument(
            '--{}'.format(processor), default=False, action='store_const',
            const=True,
            help='Use the {} processor'.format(processor))
    parser.add_argument(
        '-r', '--resolve', default=False, action='store_const', const=True,
        help='Resolve IP addresses for bandwidth measurements')
    parser.add_argument(
        '-t', '--top', default=10, type=int,
        help='Number of IPs to print for ip-bandwidth measurements')
    parser.add_argument(
        '-s', '--scale', default='MB/month',
        choices=sorted(_BandwidthProcessor._scales.keys()),
        help='Scale for the bandwidth processors')