{"action":"created","issue":{"url":"https://api.github.com/repos/firehol/netdata/issues/972","repository_url":"https://api.github.com/repos/firehol/netdata","labels_url":"https://api.github.com/repos/firehol/netdata/issues/972/labels{/name}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/972/comments","events_url":"https://api.github.com/repos/firehol/netdata/issues/972/events","html_url":"https://github.com/firehol/netdata/issues/972","id":177571204,"number":972,"title":"mysql.chart.py should not pass config variables to MySQLdb.connect if they are provided via my.cnf","user":{"login":"bbbenjie","id":12110980,"avatar_url":"https://avatars.githubusercontent.com/u/12110980?v=3","gravatar_id":"","url":"https://api.github.com/users/bbbenjie","html_url":"https://github.com/bbbenjie","followers_url":"https://api.github.com/users/bbbenjie/followers","following_url":"https://api.github.com/users/bbbenjie/following{/other_user}","gists_url":"https://api.github.com/users/bbbenjie/gists{/gist_id}","starred_url":"https://api.github.com/users/bbbenjie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbbenjie/subscriptions","organizations_url":"https://api.github.com/users/bbbenjie/orgs","repos_url":"https://api.github.com/users/bbbenjie/repos","events_url":"https://api.github.com/users/bbbenjie/events{/privacy}","received_events_url":"https://api.github.com/users/bbbenjie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-17T11:40:25Z","updated_at":"2016-09-17T17:38:13Z","closed_at":null,"body":"Hi guys,\r\nmy my.cnf sets a username, password and a socket for MySQL connections, so I may only need to setup this config at mysql.conf:\r\n\r\n```\r\nmycnf:\r\n  name     : 'local'\r\n  'my.cnf' : '/path/to/my.cnf'\r\n```\r\n\r\nUnfortunately mysql.chart.py sets the username to 'root' and empties the password and socket before it tries to connect to the server, because I only add my.cnf to mysql.conf.\r\n\r\n```\r\nif 'user' not in configuration:\r\n    self.configuration['user'] = 'root'\r\nif 'pass' not in configuration:\r\n    self.configuration['pass'] = ''\r\nif 'my.cnf' in configuration:\r\n    self.configuration['socket'] = ''\r\n    self.configuration['host'] = ''\r\n    self.configuration['port'] = 0\r\n\r\n[...]\r\n\r\nself.connection = MySQLdb.connect(user=self.configuration['user'],\r\n                                  passwd=self.configuration['pass'],\r\n                                  read_default_file=self.configuration['my.cnf'],\r\n                                  unix_socket=self.configuration['socket'],\r\n                                  host=self.configuration['host'],\r\n                                  port=self.configuration['port'],\r\n                                  connect_timeout=self.update_every)\r\n```\r\nThis is causing the following error:\r\n```\r\n16-09-17 13:08:42: python.d ERROR: mysql_mycnf Cannot establish connection to MySQL.\r\n16-09-17 13:08:42: python.d DEBUG: mysql_mycnf (2002, \"Can't connect to local MySQL server through socket '' (111)\")\r\n16-09-17 13:08:42: python.d ERROR: mysql_mycnf check function failed.\r\n16-09-17 13:08:42: python.d INFO: Disabled mysql/mycnf\r\n```\r\nFor my needs MySQLdb.connect would work if only read_default_file and connection_timeout is set:\r\n```\r\nself.connection = MySQLdb.connect(read_default_file=self.configuration['my.cnf'],\r\n                                  connect_timeout=self.update_every)\r\n```"},"comment":{"url":"https://api.github.com/repos/firehol/netdata/issues/comments/247792380","html_url":"https://github.com/firehol/netdata/issues/972#issuecomment-247792380","issue_url":"https://api.github.com/repos/firehol/netdata/issues/972","id":247792380,"user":{"login":"paulfantom","id":3531758,"avatar_url":"https://avatars.githubusercontent.com/u/3531758?v=3","gravatar_id":"","url":"https://api.github.com/users/paulfantom","html_url":"https://github.com/paulfantom","followers_url":"https://api.github.com/users/paulfantom/followers","following_url":"https://api.github.com/users/paulfantom/following{/other_user}","gists_url":"https://api.github.com/users/paulfantom/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfantom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfantom/subscriptions","organizations_url":"https://api.github.com/users/paulfantom/orgs","repos_url":"https://api.github.com/users/paulfantom/repos","events_url":"https://api.github.com/users/paulfantom/events{/privacy}","received_events_url":"https://api.github.com/users/paulfantom/received_events","type":"User","site_admin":false},"created_at":"2016-09-17T17:38:13Z","updated_at":"2016-09-17T17:38:13Z","body":"Oh, forgot about it, fixed in #975. I'm probably doing too many things at once :smile:\r\n\r\nIt needs to be tested more before accepting. I am currently running #975 on my machines and it works. @ktsaou could you run it on some of yours?"}}
{"actor":{"display_login":"paulfantom"}}