Add SSL support for InfluxDB connection.

Added ssl and verify_ssl options to influxdb config

Task: 44888
Story: 2009950
Change-Id: Icfe06233a178a5383441db6d87d46b93b6a63757
This commit is contained in:
Mirek Malinowski 2022-03-30 19:52:50 +01:00
parent 1e67714731
commit 87938f738e
3 changed files with 15 additions and 4 deletions

View File

@ -104,6 +104,7 @@ sudo chmod 640 /etc/monasca/monasca-persister.conf
Most of the configuration options should be left at default, but at a
minimum, the following should be changed:
The default value for influxdb ssl and verify_ssl is False. Only add/change if your influxdb is using SSL.
```
[zookeeper]
@ -121,6 +122,8 @@ ip_address =
port =
user =
password =
ssl =
verify_ssl =
```
### Running

View File

@ -36,6 +36,12 @@ influxdb_opts = [
cfg.PortOpt('port',
help='port to influxdb',
default=8086),
cfg.BoolOpt('ssl',
help='Boolean',
default=False),
cfg.BoolOpt('verify_ssl',
help='Boolean',
default=False),
cfg.StrOpt('user',
help='influxdb user ',
default='mon_persister'),

View File

@ -28,10 +28,12 @@ class AbstractInfluxdbRepository(abstract_repository.AbstractRepository, metacla
super(AbstractInfluxdbRepository, self).__init__()
self.conf = cfg.CONF
self._influxdb_client = influxdb.InfluxDBClient(
self.conf.influxdb.ip_address,
self.conf.influxdb.port,
self.conf.influxdb.user,
self.conf.influxdb.password)
host=self.conf.influxdb.ip_address,
port=self.conf.influxdb.port,
username=self.conf.influxdb.user,
password=self.conf.influxdb.password,
ssl=self.conf.influxdb.ssl,
verify_ssl=self.conf.influxdb.verify_ssl)
if self.conf.influxdb.db_per_tenant:
self.data_points_class = data_points.DataPointsAsDict
else: