def __init__(self, config=None, args=None): """Init the ElasticSearch export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the rabbitMQ configuration file self.uri = None self.hostname = socket.gethostname() self.export_enable = self.load_conf() if not self.export_enable: sys.exit(2)
def __init__(self, config=None, args=None): """Init the InfluxDB export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the InfluxDB configuration file self.influxdb_host = None self.influxdb_port = None self.influxdb_user = None self.influxdb_password = None self.influxdb_db = None self.export_enable = self.load_conf() if not self.export_enable: sys.exit(2) # Init the InfluxDB client self.client = self.init()
def __init__(self, config=None, args=None): """Init the InfluxDB export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the InfluxDB configuration file self.host = None self.port = None self.user = None self.password = None self.db = None self.prefix = None self.export_enable = self.load_conf() if not self.export_enable: sys.exit(2) # Init the InfluxDB client self.client = self.init()
def __init__(self, config=None, args=None): """Init the RabbitMQ export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the rabbitMQ configuration file self.rabbitmq_host = None self.rabbitmq_port = None self.rabbitmq_user = None self.rabbitmq_password = None self.rabbitmq_queue = None self.hostname = socket.gethostname() self.export_enable = self.load_conf() if not self.export_enable: sys.exit(2) # Init the rabbitmq client self.client = self.init()
def __init__(self, config=None, args=None): """Init the OpenTSDB export IF.""" GlancesExport.__init__(self, config=config, args=args) # Load the InfluxDB configuration file self.host = None self.port = None self.prefix = None self.export_enable = self.load_conf() if not self.export_enable: sys.exit(2) # Default prefix for stats is 'glances' if self.prefix is None: self.prefix = 'glances' # Init the OpenTSDB client self.client = self.init()
def __init__(self, config=None, args=None): """Init the CSV export IF.""" GlancesExport.__init__(self, config=config, args=args) # CSV file name self.csv_filename = args.export_csv # Set the CSV output file try: if is_py3: self.csv_file = open(self.csv_filename, 'w', newline='') else: self.csv_file = open(self.csv_filename, 'wb') self.writer = csv.writer(self.csv_file) except IOError as e: logger.critical("Cannot create the CSV file: {0}".format(e)) sys.exit(2) logger.info("Stats exported to CSV file: {0}".format(self.csv_filename)) self.export_enable = True self.first_line = True
def __init__(self, config=None, args=None): """Init the CSV export IF.""" GlancesExport.__init__(self, config=config, args=args) # CSV file name self.csv_filename = args.export_csv # Set the CSV output file try: if is_py3: self.csv_file = open(self.csv_filename, 'w', newline='') else: self.csv_file = open(self.csv_filename, 'wb') self.writer = csv.writer(self.csv_file) except IOError as e: logger.critical("Cannot create the CSV file: {0}".format(e)) sys.exit(2) logger.info("Stats exported to CSV file: {0}".format( self.csv_filename)) self.export_enable = True self.first_line = True
def exit(self): """Close the OpenTSDB export module.""" # Waits for all outstanding metrics to be sent and background thread closes self.client.wait() # Call the father method GlancesExport.exit(self)