def test_elasticache_client(self):
        elasticache = boto.elasticache.connect_to_region("us-west-2")

        elasticache.describe_cache_clusters()

        spans = self.memory_exporter.get_finished_spans()
        assert spans
        span = spans[0]
        self.assertEqual(span.attributes["endpoint"], "elasticcache")
        self.assertEqual(span.attributes["aws.region"], "us-west-2")
Exemple #2
0
    def test_elasticache_client(self):
        elasticache = boto.elasticache.connect_to_region("us-west-2")
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(elasticache)

        elasticache.describe_cache_clusters()

        spans = self.pop_spans()
        assert spans
        span = spans[0]
        self.assertEqual(span.get_tag("aws.region"), "us-west-2")
        self.assertEqual(span.service, "test-boto-tracing.elasticache")
        self.assertEqual(span.resource, "elasticache")
Exemple #3
0
    def test_elasticache_client(self):
        elasticache = boto.elasticache.connect_to_region('us-west-2')
        tracer = get_dummy_tracer()
        writer = tracer.writer
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(elasticache)

        elasticache.describe_cache_clusters()

        spans = writer.pop()
        assert spans
        span = spans[0]
        eq_(span.get_tag('aws.region'), 'us-west-2')
        eq_(span.service, "test-boto-tracing.elasticache")
        eq_(span.resource, "elasticache")
Exemple #4
0
    def test_elasticache_client(self):
        elasticache = boto.elasticache.connect_to_region('us-west-2')

        writer = self.tracer.writer
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(elasticache)

        elasticache.describe_cache_clusters()

        spans = writer.pop()
        assert spans
        span = spans[0]
        self.assertEqual(span.get_tag('aws.region'), 'us-west-2')
        self.assertEqual(span.service, 'test-boto-tracing.elasticache')
        self.assertEqual(span.resource, 'elasticache')
Exemple #5
0
    def test_elasticache_client(self):
        elasticache = boto.elasticache.connect_to_region('us-west-2')
        tracer = get_dummy_tracer()
        writer = tracer.writer
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(elasticache)

        elasticache.describe_cache_clusters()

        spans = writer.pop()
        assert spans
        span = spans[0]
        eq_(span.get_tag('aws.region'), 'us-west-2')
        eq_(span.service, "test-boto-tracing.elasticache")
        eq_(span.resource, "elasticache")
Exemple #6
0
def get_cache_endpoint():
    outputs = get_stack_outputs()
    if not outputs or 'CacheClusterID' not in outputs:
        return None
    cluster = elasticache.describe_cache_clusters(outputs['CacheClusterID'],
                                                  show_cache_node_info=True)
    return (
        cluster['DescribeCacheClustersResponse']['DescribeCacheClustersResult']
        ['CacheClusters'][0]['CacheNodes'][0]['Endpoint'])
Exemple #7
0
def get_cluster_info(region, identifier=None):
    """Function for fetching ElastiCache details"""
    elasticache = boto.elasticache.connect_to_region(region)
    try:
        if identifier:
            info = elasticache.describe_cache_clusters(
                identifier,
                show_cache_node_info=True)['DescribeCacheClustersResponse'][
                    'DescribeCacheClustersResult']['CacheClusters'][0]
        else:
            info = [
                v['CacheClusterId']
                for v in elasticache.describe_cache_clusters()
                ['DescribeCacheClustersResponse']
                ['DescribeCacheClustersResult']['CacheClusters']
            ]
    except boto.exception.BotoServerError:
        info = None
    return info
def get_cluster_info(region, indentifier=None):
    """Function for fetching ElastiCache details"""
    elasticache = boto.elasticache.connect_to_region(region)
    try:
        if indentifier:
            info = elasticache.describe_cache_clusters(
                indentifier,
                show_cache_node_info=True)[
                'DescribeCacheClustersResponse'][
                'DescribeCacheClustersResult'][
                'CacheClusters'][0]
        else:
            info = [v['CacheClusterId']
                    for v in elasticache.describe_cache_clusters()[
                        'DescribeCacheClustersResponse'][
                        'DescribeCacheClustersResult'][
                        'CacheClusters']]
    except boto.exception.BotoServerError:
        info = None
    return info
Exemple #9
0
def get_cache_endpoint():
    outputs = get_stack_outputs()
    if not outputs or 'CacheClusterID' not in outputs:
        return None
    cluster = elasticache.describe_cache_clusters(
        outputs['CacheClusterID'], show_cache_node_info=True
    )
    return (
        cluster['DescribeCacheClustersResponse']['DescribeCacheClustersResult']
        ['CacheClusters'][0]['CacheNodes'][0]['Endpoint']
    )
Exemple #10
0
f = open("group_vars/all/main.yml", "r")
default = yaml.load(f)
f.close()
region = default["aws_region"]
keypair = default["keypair"]
bench_tag = default["bench_tag"]

parser = argparse.ArgumentParser()
parser.add_argument("--hosts", help="List the hosts for the specified group")
parser.add_argument("--list", help="List the whole inventory", action="store_true")
args = parser.parse_args()

ec2 = boto.ec2.connect_to_region(region)

elasticache = boto.elasticache.connect_to_region(region)
clusterInfo = elasticache.describe_cache_clusters(show_cache_node_info=True)

redisHost = clusterInfo['DescribeCacheClustersResponse']['DescribeCacheClustersResult']['CacheClusters'][0]['CacheNodes'][0]['Endpoint']['Address']

reservations = ec2.get_all_instances(filters={"tag-key": "Role", "instance-state-name":"running", "tag:bench": bench_tag})
instances = [i for r in reservations for i in r.instances]

nuxeoreservations = ec2.get_all_instances(filters={"tag:Role": "nuxeo", "instance-state-name":"running", "tag:bench": bench_tag})
nuxeoinstances = [i for r in nuxeoreservations for i in r.instances]


esreservations = ec2.get_all_instances(filters={"tag:Role": "es", "instance-state-name":"running", "tag:bench": bench_tag})
esinstances = [i for r in esreservations for i in r.instances]

mongodbreservations = ec2.get_all_instances(filters={"tag:Role": "mongo", "instance-state-name":"running", "tag:bench": bench_tag})
mongodbinstances = [i for r in mongodbreservations for i in r.instances]