'Retrieve and report cluster info from hosts running recon middleware.'

def main(self):

    print(('=' * 79))
    usage = '\n                                usage:    %prog    <server_type>    [<server_type>    [<server_type>]]\n                                [-v]    [--suppress]    [-a]    [-r]    [-u]    [-d]\n                                [-l]    [-T]    [--md5]    [--auditor]    [--updater]    [--expirer]    [--sockstat]\n                                [--human-readable]\n\n                                <server_type> DCTB account|container|object\n                                Defaults    to    object    server.\n\n                                ex:    %prog    container    -l    --auditor\n                                '
    args = optparse.OptionParser(usage)
    args.add_option('--verbose', '-v', action='store_true', help='Print    verbose    info')
    args.add_option('--suppress', action='store_true', help='Suppress    most    connection    related    errors')
    args.add_option('--async', '-a', action='store_true', help='Get    async    stats')
    args.add_option('--replication', '-r', action='store_true', help='Get    replication    stats')
    args.add_option('--auditor', action='store_true', help='Get    auditor    stats')
    args.add_option('--updater', action='store_true', help='Get    updater    stats')
    args.add_option('--expirer', action='store_true', help='Get    expirer    stats')
    args.add_option('--unmounted', '-u', action='store_true', help='Check    cluster    for    unmounted    devices')
    args.add_option('--diskusage', '-d', action='store_true', help='Get    disk    usage    stats')
    args.add_option('--human-readable', action='store_true', help='Use    human    readable    suffix    for    disk    usage    stats')
    args.add_option('--loadstats', '-l', action='store_true', help='Get    cluster    load    average    stats')
    args.add_option('--quarantined', '-q', action='store_true', help='Get    cluster    quarantine    stats')
    args.add_option('--validate-servers', action='store_true', help='Validate    servers    on    the    ring')
    args.add_option('--md5', action='store_true', help='Get    md5sum    of    servers    ring    and    compare    to    local    copy')
    args.add_option('--sockstat', action='store_true', help='Get    cluster    socket    usage    stats')
    args.add_option('--driveaudit', action='store_true', help='Get    drive    audit    error    stats')
    args.add_option('--time', '-T', action='store_true', help='Check    time    synchronization')
    args.add_option('--top', type='int', metavar='COUNT', default=0, help='Also    show    the    top    COUNT    entries    in    rank    order.')
    args.add_option('--lowest', type='int', metavar='COUNT', default=0, help='Also    show    the    lowest    COUNT    entries    in    rank                                                                                                    order.')
    args.add_option('--all', action='store_true', help='Perform    all    checks.    Equal    to     DCTB  DCTB  DCTB -arudlqT    --md5    --sockstat    --auditor    --updater    --expirer    --driveaudit    --validate-servers')
    args.add_option('--region', type='int', help='Only    query    servers    in    specified    region')
    args.add_option('--zone', '-z', type='int', help='Only    query    servers    in    specified    zone')
    args.add_option('--timeout', '-t', type='int', metavar='SECONDS', help='Time    to    wait    for    a    response    from    a    server', default=5)
    args.add_option('--swiftdir', default='/etc/swift', help='Default    =    /etc/swift')
    args.add_option('--policy', '-p', help='Only    query    object    servers    in    specified    storage    policy    (specified    as    name    or    index).')
    (options, arguments) = args.parse_args()
    if ((len(sys.argv) <= 1) or (len(arguments) > len(self.check_types))):
        args.print_help()
        sys.exit(0)
    if arguments:
        arguments = set(arguments)
        if arguments.issubset(self.check_types):
            server_types = arguments
        else:
            print('Invalid    Server    Type')
            args.print_help()
            sys.exit(1)
    else:
        server_types = ['object']
    swift_dir = options.swiftdir
    if set_swift_dir(swift_dir):
        reload_storage_policies()
    self.verbose = options.verbose
    self.suppress_errors = options.suppress
    self.timeout = options.timeout
    for server_type in server_types:
        self.server_type = server_type
        ring_names = self._get_ring_names(options.policy)
        if (not ring_names):
            print(('Invalid    Storage    Policy:    %s' % options.policy))
            args.print_help()
            sys.exit(0)
        hosts = self.get_hosts(options.region, options.zone, swift_dir, ring_names)
        print(('-->    Starting    reconnaissance    on    %s    hosts    (%s)' % (len(hosts), self.server_type)))
        print(('=' * 79))
        if options.all:
            if (self.server_type == 'object'):
                self.async_check(hosts)
                self.object_auditor_check(hosts)
                self.updater_check(hosts)
                self.expirer_check(hosts)
            elif (self.server_type == 'container'):
                self.auditor_check(hosts)
                self.updater_check(hosts)
            elif (self.server_type == 'account'):
                self.auditor_check(hosts)
            self.replication_check(hosts)
            self.umount_check(hosts)
            self.load_check(hosts)
            self.disk_usage(hosts, options.top, options.lowest, options.human_readable)
            self.get_ringmd5(hosts, swift_dir)
            self.get_swiftconfmd5(hosts)
            self.quarantine_check(hosts)
            self.socket_usage(hosts)
            self.server_type_check(hosts)
            self.driveaudit_check(hosts)
            self.time_check(hosts)
        else:
            if options.async:
                if (self.server_type == 'object'):
                    self.async_check(hosts)
                else:
                    print("Error:    Can't    check    asyncs    on    non    object    servers.")
                    print(('=' * 79))
            if options.unmounted:
                self.umount_check(hosts)
            if options.replication:
                self.replication_check(hosts)
            if options.auditor:
                if (self.server_type == 'object'):
                    self.object_auditor_check(hosts)
                else:
                    self.auditor_check(hosts)
            if options.updater:
                if (self.server_type == 'account'):
                    print("Error:    Can't    check    updaters    on    account    servers.")
                    print(('=' * 79))
                else:
                    self.updater_check(hosts)
            if options.expirer:
                if (self.server_type == 'object'):
                    self.expirer_check(hosts)
                else:
                    print("Error:    Can't    check    expired    on    non    object    servers.")
                    print(('=' * 79))
            if options.validate_servers:
                self.server_type_check(hosts)
            if options.loadstats:
                self.load_check(hosts)
            if options.diskusage:
                self.disk_usage(hosts, options.top, options.lowest, options.human_readable)
            if options.md5:
                self.get_ringmd5(hosts, swift_dir)
                self.get_swiftconfmd5(hosts)
            if options.quarantined:
                self.quarantine_check(hosts)
            if options.sockstat:
                self.socket_usage(hosts)
            if options.driveaudit:
                self.driveaudit_check(hosts)
            if options.time:
                self.time_check(hosts)
