예제 #1
0
    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        # Initialize Handler
        Handler.__init__(self, config)

        self.key = self.config['apikey'].lower().strip()

        self.graphite = GraphiteHandler(self.config)
예제 #2
0
 def __init__(self, config=None):
     """
     Create a new instance of the GraphitePickleHandler
     """
     # Initialize GraphiteHandler
     GraphiteHandler.__init__(self, config)
     # Initialize Data
     self.batch = []
     # Initialize Options
     self.batch_size = int(self.config['batch'])
예제 #3
0
 def __init__(self, config=None):
     """
     Create a new instance of the GraphitePickleHandler
     """
     # Initialize GraphiteHandler
     GraphiteHandler.__init__(self, config)
     # Initialize Data
     self.batch = []
     # Initialize Options
     self.batch_size = int(self.config['batch'])
예제 #4
0
    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        self.key = config['apikey'].lower().strip()

        config['host'] = 'carbon.hostedgraphite.com'
        config['port'] = '2003'

        self.graphite = GraphiteHandler(config)
예제 #5
0
class HostedGraphiteHandler(Handler):

    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        self.key = config['apikey'].lower().strip()
        
        config['host'] = 'carbon.hostedgraphite.com'
        config['port'] = '2003'

        self.graphite = GraphiteHandler(config)

    def process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite.process(metric)

    def _process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite._process(metric)

    def _flush(self):
        self.graphite._flush()

    def flush(self):
        self.graphite.flush()
예제 #6
0
class HostedGraphiteHandler(Handler):

    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        self.key = config['apikey'].lower().strip()

        config['host'] = 'carbon.hostedgraphite.com'
        config['port'] = '2003'

        self.graphite = GraphiteHandler(config)

    def process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite.process(metric)

    def _process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite._process(metric)

    def _flush(self):
        self.graphite._flush()

    def flush(self):
        self.graphite.flush()
예제 #7
0
    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        # Initialize Handler
        Handler.__init__(self, config)

        self.key = self.config['apikey'].lower().strip()

        self.graphite = GraphiteHandler(self.config)
예제 #8
0
    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        self.key = config['apikey'].lower().strip()
        
        config['host'] = 'carbon.hostedgraphite.com'
        config['port'] = '2003'

        self.graphite = GraphiteHandler(config)
예제 #9
0
    def __init__(self, config=None):
        """
        Create a new instance of the MultiGraphiteHandler class
        """
        # Initialize Handler
        Handler.__init__(self, config)

        self.handlers = []

        # Initialize Options
        hosts = self.config['host']
        for host in hosts:
            config = deepcopy(self.config)
            config['host'] = host
            self.handlers.append(GraphiteHandler(config))
예제 #10
0
class HostedGraphiteHandler(Handler):
    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        # Initialize Handler
        Handler.__init__(self, config)

        self.key = self.config['apikey'].lower().strip()

        self.graphite = GraphiteHandler(self.config)

    def get_default_config_help(self):
        """
        Returns the help text for the configuration options for this handler
        """
        config = super(HostedGraphiteHandler, self).get_default_config_help()

        config.update({
            'apikey':
            'Api key to use',
            'host':
            'Hostname',
            'port':
            'Port',
            'proto':
            'udp or tcp',
            'timeout':
            '',
            'batch':
            'How many to store before sending to the graphite server',
            'max_backlog_multiplier':
            'how many batches to store before '
            'trimming',
            'trim_backlog_multiplier':
            'Trim down how many batches',
        })

        return config

    def get_default_config(self):
        """
        Return the default config for the handler
        """
        config = super(HostedGraphiteHandler, self).get_default_config()

        config.update({
            'apikey': '',
            'host': 'carbon.hostedgraphite.com',
            'port': 2003,
            'proto': 'tcp',
            'timeout': 15,
            'batch': 1,
            'max_backlog_multiplier': 5,
            'trim_backlog_multiplier': 4,
        })

        return config

    def process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite.process(metric)

    def _process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite._process(metric)

    def _flush(self):
        self.graphite._flush()

    def flush(self):
        self.graphite.flush()
예제 #11
0
class HostedGraphiteHandler(Handler):

    def __init__(self, config=None):
        """
        Create a new instance of the HostedGraphiteHandler class
        """
        # Initialize Handler
        Handler.__init__(self, config)

        self.key = self.config['apikey'].lower().strip()

        self.graphite = GraphiteHandler(self.config)

    def get_default_config_help(self):
        """
        Returns the help text for the configuration options for this handler
        """
        config = super(HostedGraphiteHandler, self).get_default_config_help()

        config.update({
            'apikey': 'Api key to use',
            'host': 'Hostname',
            'port': 'Port',
            'proto': 'udp or tcp',
            'timeout': '',
            'batch': 'How many to store before sending to the graphite server',
            'max_backlog_multiplier': 'how many batches to store before '
                'trimming',
            'trim_backlog_multiplier': 'Trim down how many batches',
        })

        return config

    def get_default_config(self):
        """
        Return the default config for the handler
        """
        config = super(HostedGraphiteHandler, self).get_default_config()

        config.update({
            'apikey': '',
            'host': 'carbon.hostedgraphite.com',
            'port': 2003,
            'proto': 'tcp',
            'timeout': 15,
            'batch': 1,
            'max_backlog_multiplier': 5,
            'trim_backlog_multiplier': 4,
        })

        return config

    def process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite.process(metric)

    def _process(self, metric):
        """
        Process a metric by sending it to graphite
        """
        metric = self.key + '.' + str(metric)
        self.graphite._process(metric)

    def _flush(self):
        self.graphite._flush()

    def flush(self):
        self.graphite.flush()