Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_serv(ret=None):
'''
Return an influxdb client object
'''
_options = _get_options(ret)
host = _options.get('host')
port = _options.get('port')
database = _options.get('db')
user = _options.get('user')
password = _options.get('password')
version = _get_version(host, port, user, password)
if version and "v0.8" in version:
return influxdb.influxdb08.InfluxDBClient(host=host,
port=port,
username=user,
password=password,
database=database
)
else:
return influxdb.InfluxDBClient(host=host,
port=port,
username=user,
password=password,
database=database
)
def read_influxdb_data(database, series, extra_query):
"""
Read time series data from Sanger InfluxDB server.
"""
#server = 'metrics01.internal.sanger.ac.uk'
server = '127.0.0.1'
client = InfluxDBClient(server, database=database)
query = 'select * from "%s"' % series
if extra_query:
query += (' ' + extra_query)
data = \
client.query(query)
return data
def _client(user=None, password=None, host=None, port=None):
if not user:
user = __salt__['config.option']('influxdb08.user', 'root')
if not password:
password = __salt__['config.option']('influxdb08.password', 'root')
if not host:
host = __salt__['config.option']('influxdb08.host', 'localhost')
if not port:
port = __salt__['config.option']('influxdb08.port', 8086)
return influxdb.influxdb08.InfluxDBClient(
host=host, port=port, username=user, password=password)