Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #32 from trinitronx/master

Reworked patch to fix issue #28
  • Loading branch information...
commit 20b0fefa5f69943543eaa1bd47f048d94f46358e 2 parents c5424a4 + 53161f8
Dag Wieers authored
Showing with 4 additions and 23 deletions.
  1. +4 −23 plugins/dstat_mysql5_cmds.py
27 plugins/dstat_mysql5_cmds.py
View
@@ -6,15 +6,6 @@
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
-global mysql_host
-mysql_host = os.getenv('DSTAT_MYSQL_HOST')
-
-global mysql_port
-mysql_port = os.getenv('DSTAT_MYSQL_PORT')
-
-global mysql_socket
-mysql_socket = os.getenv('DSTAT_MYSQL_SOCKET')
-
class dstat_plugin(dstat):
"""
Plugin for MySQL 5 commands.
@@ -31,19 +22,7 @@ def check(self):
global MySQLdb
import MySQLdb
try:
- args = {}
- if mysql_user:
- args['user'] = mysql_user
- if mysql_pwd:
- args['passwd'] = mysql_pwd
- if mysql_host:
- args['host'] = mysql_host
- if mysql_port:
- args['port'] = mysql_port
- if mysql_socket:
- args['unix_socket'] = mysql_socket
-
- self.db = MySQLdb.connect(**args)
+ self.db = MySQLdb.connect(user=mysql_user, passwd=mysql_pwd)
except Exception, e:
raise Exception, 'Cannot interface with MySQL server: %s' % e
@@ -54,7 +33,9 @@ def extract(self):
c.execute("""show global status like '%s';""" % name)
line = c.fetchone()
if line[0] in self.vars:
- self.set2[line[0]] = long(line[1])
+ if line[0] + 'raw' in self.set2:
+ self.set2[line[0]] = long(line[1]) - self.set2[line[0] + 'raw']
+ self.set2[line[0] + 'raw'] = long(line[1])
for name in self.vars:
self.val[name] = self.set2[name] * 1.0 / elapsed
Please sign in to comment.
Something went wrong with that request. Please try again.