Skip to content

Commit b4060c1

Browse files
committed
Custom mysql port and timeout integer fix
When mysql.pyconf configured with custom port: param port { value = 3307 } gmond gives into log: [PYTHON] Can't call the metric_init function in the python module [mysql].ganglia#12 and further investigation with *gmond -d 1* shows [PYTHON] Can't call the metric_init function in the python module [mysql]. Traceback (most recent call last): File "/usr/lib64/ganglia/python_modules/mysql.py", line 1005, in metric_init update_stats(REPORT_INNODB, REPORT_MASTER, REPORT_SLAVE) File "/usr/lib64/ganglia/python_modules/mysql.py", line 86, in update_stats conn = MySQLdb.connect(**mysql_conn_opts) File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect return Connection(*args, **kwargs) File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__ super(Connection, self).__init__(*args, **kwargs2) TypeError: an integer is required Method params.get converted explicitly as integer with timeout and port option.
1 parent ff02e90 commit b4060c1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mysqld/python_modules/mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ def metric_init(params):
378378
host = params.get('host', 'localhost'),
379379
user = params.get('user'),
380380
passwd = params.get('passwd'),
381-
port = params.get('port', 3306),
382-
connect_timeout = params.get('timeout', 30),
381+
port = int(params.get('port', 3306)),
382+
connect_timeout = int(params.get('timeout', 30)),
383383
)
384384
if params.get('unix_socket', '') != '':
385385
mysql_conn_opts['unix_socket'] = params.get('unix_socket')

0 commit comments

Comments
 (0)