"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_mysql5_conn.py" between
dstat-0.7.3.tar.gz and dstat-0.7.4.tar.gz

About: dstat is a versatile resource statistic tool and a replacement for vmstat, iostat and ifstat (using Python).

dstat_mysql5_conn.py  (dstat-0.7.3):dstat_mysql5_conn.py  (dstat-0.7.4)
skipping to change at line 48 skipping to change at line 48
if mysql_pwd: if mysql_pwd:
args['passwd'] = mysql_pwd args['passwd'] = mysql_pwd
if mysql_host: if mysql_host:
args['host'] = mysql_host args['host'] = mysql_host
if mysql_port: if mysql_port:
args['port'] = mysql_port args['port'] = mysql_port
if mysql_socket: if mysql_socket:
args['unix_socket'] = mysql_socket args['unix_socket'] = mysql_socket
self.db = MySQLdb.connect(**args) self.db = MySQLdb.connect(**args)
except Exception, e: except Exception as e:
raise Exception, 'Cannot interface with MySQL server, %s' % e raise Exception('Cannot interface with MySQL server, %s' % e)
def extract(self): def extract(self):
try: try:
c = self.db.cursor() c = self.db.cursor()
c.execute("""show global variables like 'max_connections';""") c.execute("""show global variables like 'max_connections';""")
max = c.fetchone() max = c.fetchone()
c.execute("""show global status like 'Threads_connected';""") c.execute("""show global status like 'Threads_connected';""")
thread = c.fetchone() thread = c.fetchone()
if thread[0] in self.vars: if thread[0] in self.vars:
self.set2[thread[0]] = float(thread[1]) self.set2[thread[0]] = float(thread[1])
self.set2['Threads'] = float(thread[1]) / float(max[1]) * 100.0 self.set2['Threads'] = float(thread[1]) / float(max[1]) * 100.0
for name in self.vars: for name in self.vars:
self.val[name] = self.set2[name] * 1.0 / elapsed self.val[name] = self.set2[name] * 1.0 / elapsed
if step == op.delay: if step == op.delay:
self.set1.update(self.set2) self.set1.update(self.set2)
except Exception, e: except Exception as e:
for name in self.vars: for name in self.vars:
self.val[name] = -1 self.val[name] = -1
# vim:ts=4:sw=4:et # vim:ts=4:sw=4:et
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)