summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/yardstick/yardstick.conf.sample2
-rw-r--r--yardstick/dispatcher/influxdb.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/etc/yardstick/yardstick.conf.sample b/etc/yardstick/yardstick.conf.sample
index edbd5bcb0..f4eff05d3 100644
--- a/etc/yardstick/yardstick.conf.sample
+++ b/etc/yardstick/yardstick.conf.sample
@@ -25,3 +25,5 @@
# timeout = 5
# target = http://127.0.0.1:8086
# db_name = yardstick
+# username = root
+# password = root
diff --git a/yardstick/dispatcher/influxdb.py b/yardstick/dispatcher/influxdb.py
index a0948166e..f61912d72 100644
--- a/yardstick/dispatcher/influxdb.py
+++ b/yardstick/dispatcher/influxdb.py
@@ -30,6 +30,12 @@ influx_dispatcher_opts = [
cfg.StrOpt('db_name',
default='yardstick',
help='The database name to store test results.'),
+ cfg.StrOpt('username',
+ default='root',
+ help='The user name to access database.'),
+ cfg.StrOpt('password',
+ default='root',
+ help='The user password to access database.'),
cfg.IntOpt('timeout',
default=5,
help='The max time in seconds to wait for a request to '
@@ -50,6 +56,8 @@ class InfluxdbDispatcher(DispatchBase):
self.timeout = CONF.dispatcher_influxdb.timeout
self.target = CONF.dispatcher_influxdb.target
self.db_name = CONF.dispatcher_influxdb.db_name
+ self.username = CONF.dispatcher_influxdb.username
+ self.password = CONF.dispatcher_influxdb.password
self.influxdb_url = "%s/write?db=%s" % (self.target, self.db_name)
self.raw_result = []
self.case_name = ""
@@ -146,6 +154,7 @@ class InfluxdbDispatcher(DispatchBase):
LOG.debug('Test result line format : %s' % line)
res = requests.post(self.influxdb_url,
data=line,
+ auth=(self.username, self.password),
timeout=self.timeout)
if res.status_code != 204:
LOG.error('Test result posting finished with status code'