diff options
author | Ilya Mashchenko <ilyamaschenko@gmail.com> | 2019-03-12 13:10:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-12 13:10:04 +0300 |
commit | d6d7cb59fe118902bbc853ba4a6b0ce7b547f64b (patch) | |
tree | f89bc83de0700588eb9075690635a3e611cf19c5 /collectors/python.d.plugin/python_modules | |
parent | c2669a8431a781e703a166db9d64d42664939449 (diff) |
mysql module add ssl connection support (#5610)
<!--
Describe the change in summary section, including rationale and degin decisions.
Include "Fixes #nnn" if you are fixing an existing issue.
In "Component Name" section write which component is changed in this PR. This
will help us review your PR quicker.
If you have more information you want to add, write them in "Additional
Information" section. This is usually used to help others understand your
motivation behind this change. A step-by-step reproduction of the problem is
helpful if there is no related issue.
-->
##### Summary
Fixes: #5608
Add ssl connection support to MySQLService
> python-mysqlclient connection
```
:param dict ssl:
dictionary or mapping contains SSL connection parameters;
see the MySQL documentation for more details
(mysql_ssl_set()). If this is set, and the client does not
support SSL, NotSupportedError will be raised.
```
[SSL connection parameters:](https://dev.mysql.com/doc/refman/5.6/en/mysql-ssl-set.html)
- **key**: The path name of the client private key file.
- **cert**: The path name of the client public key certificate file.
- **ca**: The path name of the Certificate Authority (CA) certificate file. This option, if used, must specify the same certificate used by the server.
- **capath**: The path name of the directory that contains trusted SSL CA certificate files.
- **cipher**: The list of permitted ciphers for SSL encryption.
##### Component Name
[`collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService`](https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py)
___
@woosley please test it
```yaml
tcp:
name : 'local'
user : 'user'
pass : 'pass'
host : 'localhost'
port : '3306'
ssl:
key: 'path/to/key'
cert: 'path/to/cet'
ca: 'path/to/ca'
```
Diffstat (limited to 'collectors/python.d.plugin/python_modules')
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py index 9a694aa825..a09041ca48 100644 --- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py @@ -44,6 +44,7 @@ class MySQLService(SimpleService): properties['user'] = conf['user'] if conf.get('pass'): properties['passwd'] = conf['pass'] + if conf.get('socket'): properties['unix_socket'] = conf['socket'] elif conf.get('host'): @@ -51,9 +52,14 @@ class MySQLService(SimpleService): properties['port'] = int(conf.get('port', 3306)) elif conf.get('my.cnf'): if MySQLdb.__name__ == 'pymysql': + # TODO: this is probablt wrong, it depends on version self.error('"my.cnf" parsing is not working for pymysql') else: properties['read_default_file'] = conf['my.cnf'] + + if conf.get('ssl'): + properties['ssl'] = conf['ssl'] + if isinstance(extra_conf, dict) and extra_conf: properties.update(extra_conf) |