"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_mysql5_cmds.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_cmds.py  (dstat-0.7.3):dstat_mysql5_cmds.py  (dstat-0.7.4)
skipping to change at line 47 skipping to change at line 47
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()
for name in self.vars: for name in self.vars:
c.execute("""show global status like '%s';""" % name) c.execute("""show global status like '%s';""" % name)
line = c.fetchone() line = c.fetchone()
if line[0] in self.vars: if line[0] in self.vars:
if line[0] + 'raw' in self.set2: if line[0] + 'raw' in self.set2:
self.set2[line[0]] = long(line[1]) - self.set2[line[0] + self.set2[line[0]] = int(line[1]) - self.set2[line[0] +
'raw'] 'raw']
self.set2[line[0] + 'raw'] = long(line[1]) self.set2[line[0] + 'raw'] = int(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
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added

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