Skip to content

Instantly share code, notes, and snippets.

@n0ts
Created December 22, 2014 02:23
Show Gist options
  • Save n0ts/723535f680ac7f400a7e to your computer and use it in GitHub Desktop.
Save n0ts/723535f680ac7f400a7e to your computer and use it in GitHub Desktop.
Patch gmond/python_modules/db/mysql.py
--- ./gmond/python_modules/db/mysql.py-org 2014-10-23 10:20:38.000000000 +0900
+++ ./gmond/python_modules/db/mysql.py 2014-10-23 12:23:31.000000000 +0900
@@ -113,7 +113,7 @@
if get_innodb:
cursor = conn.cursor(MySQLdb.cursors.Cursor)
cursor.execute("SHOW /*!50000 ENGINE*/ INNODB STATUS")
- innodb_status = parse_innodb_status(cursor.fetchone()[0].split('\n'))
+ innodb_status = parse_innodb_status(cursor.fetchone()[2].split('\n'))
cursor.close()
logging.debug('innodb_status: ' + str(innodb_status))
@@ -341,8 +341,9 @@
host = params.get('host', 'localhost'),
user = params.get('user'),
passwd = params.get('passwd'),
- port = params.get('port', 3306),
- connect_timeout = params.get('timeout', 30),
+ port = int(params.get('port', 3306)),
+ unix_socket = params.get('socket', ''),
+ connect_timeout = int(params.get('timeout', 30)),
)
master_stats_descriptions = {}
@@ -1038,6 +1039,7 @@
parser.add_option("-u", "--user", dest="user", help="user to connect as", default="")
parser.add_option("-p", "--password", dest="passwd", help="password", default="")
parser.add_option("-P", "--port", dest="port", help="port", default=3306, type="int")
+ parser.add_option("-S", "--socket", dest="socket", help="socket", default="/var/lib/mysql/mysql.sock")
parser.add_option("--no-innodb", dest="get_innodb", action="store_false", default=True)
parser.add_option("--no-master", dest="get_master", action="store_false", default=True)
parser.add_option("--no-slave", dest="get_slave", action="store_false", default=True)
@@ -1053,6 +1055,7 @@
'passwd': options.passwd,
'user': options.user,
'port': options.port,
+ 'socket': options.socket,
'get_innodb': options.get_innodb,
'get_master': options.get_master,
'get_slave': options.get_slave,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment