#!/usr/bin/python
import MySQLdb
import pycurl
def master_work(ip,port):
print ip,port
conn=MySQLdb.connect(host=str(ip),user='***',passwd='****',port=int(port))
cur=conn.cursor(cursorclass=MySQLdb.cursors.DictCursor)
cur.execute('show status;')
result=cur.fetchall()
#conn1=result[-5]['Value']
for result_master in result:
if result_master['Variable_name'] == 'Threads_running':
conn1=result_master['Value']
print str(ip),str(port),str(conn1)
cur.execute('show global variables like "%conn%";')
result_2=cur.fetchall()
for results_master in result_2:
if results_master['Variable_name'] == 'max_user_connections':
max_conn=results_master['Value