def load_influx_settings(self):
"""Load Influxdb server information stored in database base."""
try:
settings = {}
field_names = '''
server
port
username
password
'''.split()
sql = 'SELECT {fields} FROM influx_settings LIMIT 1;'.format(
fields=', '.join(field_names))
database = sqlite3.connect(utilities.DB_CORE)
db_elements = database.cursor().execute(sql).fetchone()
for field, value in zip(field_names, db_elements):
settings[field] = value
self.ifconn = InfluxDBClient(
settings["server"], settings["port"], settings["username"], settings["password"]
)
Log.info("Influxdb information loaded.")
except Exception as excpt:
Log.exception("Trying to load Influx server information: %s.", excpt)
finally:
database.close()
评论列表
文章目录