Esempio n. 1
0
    def __init__(self, boundary_metric_prefix):
        self.boundary_metric_prefix = boundary_metric_prefix
        self.settings = boundary_plugin.parse_params()
        self.accumulator = boundary_accumulator

        service_port = self.settings.get("service_port", DEFAULT_PORT)
        service_host = self.settings.get("service_host", DEFAULT_HOST)

        self._address = (service_host, int(service_port))
        self._timeout = self.settings.get("service_timeout", DEFAULT_TIMEOUT)
    def __init__(self, boundary_metric_prefix):
        self.boundary_metric_prefix = boundary_metric_prefix
        self.settings = boundary_plugin.parse_params()
        self.accumulator = boundary_accumulator
	
	service_port = self.settings.get("service_port", DEFAULT_PORT)
	service_host = self.settings.get("service_host", DEFAULT_HOST)
	
	self._address = (service_host, int(service_port))
	self._timeout = self.settings.get("service_timeout", DEFAULT_TIMEOUT)
Esempio n. 3
0
 def __init__(self, boundary_metric_prefix):
     self.boundary_metric_prefix = boundary_metric_prefix
     self.settings = boundary_plugin.parse_params()
     self.accumulator = boundary_accumulator
 def __init__(self, boundary_metric_prefix):
     self.boundary_metric_prefix = boundary_metric_prefix
     self.settings = boundary_plugin.parse_params()
import redis
import sys
import time
import socket

import boundary_plugin

params = boundary_plugin.parse_params()
redis_server = params.get('redis_hostname', None) or 'localhost'
redis_port = int(params.get('redis_port', None) or 6379)
redis_password = params.get('redis_password', None) or None

if not redis_password:
    redis_password = None
r = redis.Redis(redis_server, redis_port, password=redis_password)

_accum = dict()


def accum(stat_name, new_value):
    global _accum

    try:
        old_value = _accum[stat_name]
    except KeyError:
        old_value = new_value

    diff = new_value - old_value
    _accum[stat_name] = new_value
    return diff
 def __init__(self, boundary_metric_prefix):
     self.boundary_metric_prefix = boundary_metric_prefix
     self.settings = boundary_plugin.parse_params()
     self.accumulator = boundary_accumulator
     self.cmdGen = cmdgen.CommandGenerator()
 def __init__(self, boundary_metric_prefix):
     self.boundary_metric_prefix = boundary_metric_prefix
     self.settings = boundary_plugin.parse_params()
     self.accumulator = boundary_accumulator
     self.listener_app = None
Esempio n. 8
0
    def __init__(self, boundary_metric_prefix):
        self.boundary_metric_prefix = boundary_metric_prefix
        self.settings = boundary_plugin.parse_params()
        self.accumulator = boundary_accumulator
	self.base_url = self.settings.get("base_url", "http://localhost:8983/solr/")
Esempio n. 9
0
 def __init__(self, boundary_metric_prefix):
     self.boundary_metric_prefix = boundary_metric_prefix
     self.settings = boundary_plugin.parse_params()
     self.accumulator = boundary_accumulator
     self.base_url = self.settings.get("base_url",
                                       "http://localhost:8983/solr/")
import redis
import sys
import time
import socket

import boundary_plugin

params = boundary_plugin.parse_params()
redis_server = params.get('redis_hostname', None) or 'localhost'
redis_port = int(params.get('redis_port', None) or 6379)
redis_password = params.get('redis_password', None) or None

if not redis_password:
    redis_password = None
r = redis.Redis(redis_server, redis_port, password=redis_password)

_accum = dict()

def accum(stat_name, new_value):
    global _accum

    try:
        old_value = _accum[stat_name]
    except KeyError:
        old_value = new_value

    diff = new_value - old_value
    _accum[stat_name] = new_value
    return diff

# List of values returned from Redis' info call to report to Boundary.
                    logger.info("\t\t\tNo data")
                    continue

                if only_latest:
                    # Pick out the latest sample only
                    data = [max(data, key=lambda d: d['Timestamp'])]
                else:
                    # Output all retrieved samples as a list, sorted by timestamp
                    data = sorted(data, key=lambda d: d['Timestamp'])

                out_metric = []
                for sample in data:
                    logger.info("\t\t\tELB Value: %s: %s" % (sample['Timestamp'], sample[metric_statistic]))
                    out_metric.append((sample['Timestamp'], sample[metric_statistic], metric_statistic, metric_name_id))
                out[(region.name, lb.name, metric_name)] = out_metric

    return out

# For testing, if this script is called directly, attempt to get some data and
# print it nicely.
if __name__ == '__main__':
    import pprint
    from boundary_plugin import parse_params

    logging.basicConfig(level=logging.ERROR)
    settings = parse_params()

    data = get_elb_metrics(settings['access_key_id'], settings['secret_key'])
    pprint.pprint(data)