Skip to content

Commit

Permalink
add influx ssl option
Browse files Browse the repository at this point in the history
Add possibility to connect to InfluxDB via https.
Also adding the option for verifying the https cert.
  • Loading branch information
symptog committed Dec 7, 2017
1 parent f3b2eb9 commit cf31ea5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/mgr/influx.rst
Expand Up @@ -53,6 +53,8 @@ Additional optional configuration settings are:
:interval: Time between reports to InfluxDB. Default 5 seconds.
:database: InfluxDB database name. Default "ceph". You will need to create this database and grant write privileges to the configured username or the username must have admin privileges to create it.
:port: InfluxDB server port. Default 8086
:ssl: Use https connection for InfluxDB server. Default false
:verify_ssl: Verify https cert for InfluxDB server. Default false


---------
Expand Down
17 changes: 16 additions & 1 deletion src/pybind/mgr/influx/module.py
Expand Up @@ -111,7 +111,22 @@ def send_to_influx(self):
username = self.get_config("username", default="")
password = self.get_config("password", default="")

client = InfluxDBClient(host, port, username, password, database)
# Use https connection to influx
ssl = self.get_config("ssl", default="false")
if ssl.lower() == "true":
ssl = True
else:
ssl = False

# Verify https cert
verify_ssl = self.get_config("verify_ssl", default="false")
if verify_ssl.lower() == "true":
verify_ssl = True
else:
verify_ssl = False


client = InfluxDBClient(host, port, username, password, database, ssl, verify_ssl)

# using influx client get_list_database requires admin privs, instead we'll catch the not found exception and inform the user if db can't be created
try:
Expand Down

0 comments on commit cf31ea5

Please sign in to comment.