def check_db_status():
# if the db is not found, then try to create it
try:
dbclient = InfluxDBClient(db_server, db_port, db_admin, db_admin_password)
dblist = dbclient.get_list_database()
db_found = False
for db in dblist:
if db['name'] == db_name:
db_found = True
if not(db_found):
logger.info('Database <%s> not found, trying to create it', db_name)
dbclient.create_database(db_name)
return True
except Exception as e:
logger.error('Error querying open-nti database: %s', e)
return False
评论列表
文章目录