Exemplo n.º 1
0
    if options.update_retention:
        logging.info("Altering retention policies")
        client.alter_retention_policy("default", duration="4w", replication=1, default=True)

    # forces read-only
    options.testmode = True
    settings.env = options.env.lower()

    logging.info("Connecting to appliance in %s, testmode:%s" % (settings.env, options.testmode))
    connection = SolaceAPI(settings.env, testmode=options.testmode)

    """
    Gather client stats, this is quite slow if you have MANY clients!
    """
    if options.clients:
        connection.x = SolaceXMLBuilder("show clients stats")
        connection.x.show.client.name = options.filter
        connection.x.show.client.stats

        # measurement point start
        startTime = time.time()

        # set time now immediately before we request
        timeNow = get_time()

        # get the clients
        clients = connection.rpc(str(connection.x), primaryOnly=True)

        # iterate over values of interest.
        for c in clients[0]['rpc-reply']['rpc']['show']['client']['primary-virtual-router']['client']:
            logging.debug(c)
                logging.warn(
                    "Unable to create database, does it already exist?")
        except Exception, e:
            logging.error("Unable to connect to influxdb")
            sys.exit(1)

    # forces read-only
    options.testmode = True
    settings.env = options.env.lower()

    logging.info("Connecting to appliance in %s, testmode:%s" %
                 (settings.env, options.testmode))
    connection = SolaceAPI(settings.env, testmode=options.testmode)

    if options.details:
        connection.x = SolaceXMLBuilder("show clients details")
        connection.x.show.client.name = options.client
        connection.x.show.client.detais
    elif options.stats:
        connection.x = SolaceXMLBuilder("show clients stats")
        connection.x.show.client.name = options.client
        connection.x.show.client.stats

    # get the clients
    clients = connection.rpc(str(connection.x), primaryOnly=True)
    count = 0

    # print clients[0]

    timeNow = strftime("%Y-%m-%dT%H:%M:%SZ", gmtime())
                client.create_database(options.influxdb_db)
            except Exception, e:
                logging.warn("Unable to create database, does it already exist?")
        except Exception, e:
            logging.error("Unable to connect to influxdb")
            sys.exit(1)

    # forces read-only
    options.testmode = True
    settings.env = options.env.lower()

    logging.info("Connecting to appliance in %s, testmode:%s" % (settings.env, options.testmode))
    connection = SolaceAPI(settings.env, testmode=options.testmode)

    if options.details:
        connection.x = SolaceXMLBuilder("show clients details")
        connection.x.show.client.name = options.client
        connection.x.show.client.detais
    elif options.stats:
        connection.x = SolaceXMLBuilder("show clients stats")
        connection.x.show.client.name = options.client
        connection.x.show.client.stats

    # get the clients
    clients = connection.rpc(str(connection.x), primaryOnly=True)
    count = 0

    # print clients[0]

    timeNow = strftime("%Y-%m-%dT%H:%M:%SZ", gmtime())
                                      duration="4w",
                                      replication=1,
                                      default=True)

    # forces read-only
    options.testmode = True
    settings.env = options.env.lower()

    logging.info("Connecting to appliance in %s, testmode:%s" %
                 (settings.env, options.testmode))
    connection = SolaceAPI(settings.env, testmode=options.testmode)
    """
    Gather client stats, this is quite slow if you have MANY clients!
    """
    if options.clients:
        connection.x = SolaceXMLBuilder("show clients stats")
        connection.x.show.client.name = options.filter
        connection.x.show.client.stats

        # measurement point start
        startTime = time.time()

        # set time now immediately before we request
        timeNow = get_time()

        # get the clients
        clients = connection.rpc(str(connection.x), primaryOnly=True)

        # iterate over values of interest.
        for c in clients[0]['rpc-reply']['rpc']['show']['client'][
                'primary-virtual-router']['client']: