"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_mysql5_keys.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_keys.py  (dstat-0.7.3):dstat_mysql5_keys.py  (dstat-0.7.4)
skipping to change at line 49 skipping to change at line 49
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: except:
raise Exception, 'Cannot interface with MySQL server' raise Exception('Cannot interface with MySQL server')
def extract(self): def extract(self):
try: try:
c = self.db.cursor() c = self.db.cursor()
c.execute("""show global status like 'Key_%';""") c.execute("""show global status like 'Key_%';""")
lines = c.fetchall() lines = c.fetchall()
for line in lines: for line in lines:
if len(line[1]) < 2: continue if len(line[1]) < 2: continue
if line[0] in self.vars: if line[0] in self.vars:
self.set2[line[0]] = float(line[1]) self.set2[line[0]] = float(line[1])
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. 
2 lines changed or deleted 2 lines changed or added

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