From 7152edfeb12a513c0a09fddaf9c28f49a6cfd8f1 Mon Sep 17 00:00:00 2001 From: Rider Woo Date: Mon, 7 Sep 2015 09:48:15 +0800 Subject: [PATCH 1/2] Update mysql.py add support for customised mysql unix socket path --- mysql.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mysql.py b/mysql.py index c5182a2..44ab476 100644 --- a/mysql.py +++ b/mysql.py @@ -34,6 +34,7 @@ 'Password': '', 'HeartbeatTable': '', 'Verbose': False, + 'Socket': '/var/lib/mysql/mysql.sock' } MYSQL_STATUS_VARS = { @@ -289,7 +290,8 @@ def get_mysql_conn(): host=MYSQL_CONFIG['Host'], port=MYSQL_CONFIG['Port'], user=MYSQL_CONFIG['User'], - passwd=MYSQL_CONFIG['Password'] + passwd=MYSQL_CONFIG['Password'], + unix_socket=MYSQL_CONFIG['Socket'] ) def mysql_query(conn, query): From 0f7b1c2efbd4e664ab2fb2c5919815ccccea7e0f Mon Sep 17 00:00:00 2001 From: Rider Woo Date: Mon, 7 Sep 2015 09:49:54 +0800 Subject: [PATCH 2/2] Update README.md add "Socket" syntax fix config name error --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bcf609c..416e8b2 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,11 @@ You should then configure the MySQL plugin: Port 3306 (default: 3306) User "root" (default: root) Password "xxxx" (default: empty) + Socket "/var/lib/mysql/mysql.sock" (default: /var/lib/mysql/mysql.sock) HeartbeatTable "percona.heartbeat" (if using pt-heartbeat to track slave lag) Verbose false (default: false) - + ## Metrics @@ -323,4 +324,4 @@ For versions of MySQL with support for it and where enabled, `INFORMATION_SCHEMA response_time_count.14 ## License -MIT (http://www.opensource.org/licenses/mit-license.php) \ No newline at end of file +MIT (http://www.opensource.org/licenses/mit-license.php)