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

        # Initialize Options
        # host
        self.host = str(self.config['host'])
        self.port = int(self.config['port'])
        self.timeout = int(self.config['timeout'])
        # Authorization
        self.user = str(self.config['user'])
        self.password = str(self.config['password'])
        # data
        self.batch = int(self.config['batch'])
        self.compression = int(self.config['compression'])
        # prefix
        if self.config['prefix'] != "":
            self.prefix = str(self.config['prefix'])+'.'
        else:
            self.prefix = ""
        # tags
        self.tags = []
        pattern = re.compile(r'([a-zA-Z0-9]+)=([a-zA-Z0-9]+)')
        for (key, value) in re.findall(pattern, str(self.config['tags'])):
            self.tags.append([key, value])

        # headers
        self.httpheader = {"Content-Type": "application/json"}
        # Authorization
        if self.user != "":
            self.httpheader["Authorization"] = "Basic " +\
                base64.encodestring('%s:%s' % (self.user, self.password))[:-1]
        # compression
        if self.compression >= 1:
            self.httpheader["Content-Encoding"] = "gzip"
        self.entrys = []

        self.skipAggregates = self.config['skipAggregates']
        self.cleanMetrics = self.config['cleanMetrics']
def __init__ ( self , config = None ) : # Initialize Handler Handler . __init__ ( self , config ) # Initialize Options # host self . host = str ( self . config [ 'host' ] ) self . port = int ( self . config [ 'port' ] ) self . timeout = int ( self . config [ 'timeout' ] ) # Authorization self . user = str ( self . config [ 'user' ] ) self . password = str ( self . config [ 'password' ] ) # data self . batch = int ( self . config [ 'batch' ] ) self . compression = int ( self . config [ 'compression' ] ) # prefix if self . config [ 'prefix' ] != "" : self . prefix = str ( self . config [ 'prefix' ] ) + '.' else : self . prefix = "" # tags self . tags = [ ] pattern = re . compile ( r'([a-zA-Z0-9]+)=([a-zA-Z0-9]+)' ) for ( key , value ) in re . findall ( pattern , str ( self . config [ 'tags' ] ) ) : self . tags . append ( [ key , value ] ) # headers self . httpheader = { "Content-Type" : "application/json" } # Authorization if self . user != "" : self . httpheader [ "Authorization" ] = "Basic " + base64 . encodestring ( '%s:%s' % ( self . user , self . password ) ) [ : - 1 ] # compression if self . compression >= 1 : self . httpheader [ "Content-Encoding" ] = "gzip" self . entrys = [ ] self . skipAggregates = self . config [ 'skipAggregates' ] self . cleanMetrics = self . config [ 'cleanMetrics' ]