[svn] r5707 - in trunk/tools/dstat: . plugins
packagers at lists.rpmforge.net
packagers at lists.rpmforge.net
Fri Aug 10 22:41:11 CEST 2007
Author: dag
Date: 2007-08-10 22:41:10 +0200 (Fri, 10 Aug 2007)
New Revision: 5707
Added:
trunk/tools/dstat/plugins/dstat_mysql_io.py
trunk/tools/dstat/plugins/dstat_mysql_keys.py
Modified:
trunk/tools/dstat/TODO
trunk/tools/dstat/dstat
trunk/tools/dstat/plugins/dstat_innodb_buffer.py
trunk/tools/dstat/plugins/dstat_innodb_io.py
trunk/tools/dstat/plugins/dstat_innodb_ops.py
Log:
Added mysql plugins and changes to innodb.
Modified: trunk/tools/dstat/TODO
===================================================================
--- trunk/tools/dstat/TODO 2007-08-10 16:10:02 UTC (rev 5706)
+++ trunk/tools/dstat/TODO 2007-08-10 20:41:10 UTC (rev 5707)
@@ -40,7 +40,7 @@
+ Allow for SNMP counters to be added
+ Add LVM stats
+ Add number of (active) X sessions and X clients
-+ Add a 'most expensive mem app' and 'most expensive io app'
++ Add 'most expensive io app' and 'most expensive X app'
+ Allow to have multiple '1st expensive ... app' and '2nd expensive ... app'
### Documentation (help welcome!)
Modified: trunk/tools/dstat/dstat
===================================================================
--- trunk/tools/dstat/dstat 2007-08-10 16:10:02 UTC (rev 5706)
+++ trunk/tools/dstat/dstat 2007-08-10 20:41:10 UTC (rev 5707)
@@ -1879,11 +1879,10 @@
exec 'o = dstat_%s()' % mod
# print o.__module__
except Exception, e:
- if mod != mods[-1]:
- if op.debug:
- info(1, 'Module %s failed to load, trying another. (%s)' % (mod, e))
- else:
+ if mod == mods[-1]:
info(1, 'Module %s failed to load, giving up. (%s)' % (mod, e))
+ elif op.debug:
+ info(1, 'Module %s failed to load, trying another. (%s)' % (mod, e))
if op.debug:
raise
# tb = sys.exc_info()[2]
Modified: trunk/tools/dstat/plugins/dstat_innodb_buffer.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_innodb_buffer.py 2007-08-10 16:10:02 UTC (rev 5706)
+++ trunk/tools/dstat/plugins/dstat_innodb_buffer.py 2007-08-10 20:41:10 UTC (rev 5707)
@@ -36,13 +36,11 @@
self.cn1.update(self.cn2)
except IOError, e:
- if op.debug:
- print 'dstat_innodb_buffer: lost pipe to mysql,', e
+ if op.debug: print 'dstat_innodb_buffer: lost pipe to mysql,', e
for name in self.vars: self.val[name] = -1
except Exception, e:
- if op.debug:
- print 'dstat_innodb_buffer: exception', e
+ if op.debug: print 'dstat_innodb_buffer: exception', e
for name in self.vars: self.val[name] = -1
# vim:ts=4:sw=4:et
Modified: trunk/tools/dstat/plugins/dstat_innodb_io.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_innodb_io.py 2007-08-10 16:10:02 UTC (rev 5706)
+++ trunk/tools/dstat/plugins/dstat_innodb_io.py 2007-08-10 20:41:10 UTC (rev 5707)
@@ -36,13 +36,11 @@
self.cn1.update(self.cn2)
except IOError, e:
- if op.debug:
- print 'dstat_innodb_buffer: lost pipe to mysql,', e
+ if op.debug: print 'dstat_innodb_buffer: lost pipe to mysql,', e
for name in self.vars: self.val[name] = -1
except Exception, e:
- if op.debug:
- print 'dstat_innodb_buffer: exception', e
+ if op.debug: print 'dstat_innodb_buffer: exception', e
for name in self.vars: self.val[name] = -1
# vim:ts=4:sw=4:et
Modified: trunk/tools/dstat/plugins/dstat_innodb_ops.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_innodb_ops.py 2007-08-10 16:10:02 UTC (rev 5706)
+++ trunk/tools/dstat/plugins/dstat_innodb_ops.py 2007-08-10 20:41:10 UTC (rev 5707)
@@ -37,13 +37,11 @@
self.cn1.update(self.cn2)
except IOError, e:
- if op.debug:
- print 'dstat_innodb_buffer: lost pipe to mysql,', e
+ if op.debug: print 'dstat_innodb_buffer: lost pipe to mysql,', e
for name in self.vars: self.val[name] = -1
except Exception, e:
- if op.debug:
- print 'dstat_innodb_buffer: exception', e
+ if op.debug: print 'dstat_innodb_buffer: exception', e
for name in self.vars: self.val[name] = -1
# vim:ts=4:sw=4:et
Added: trunk/tools/dstat/plugins/dstat_mysql_io.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_mysql_io.py (rev 0)
+++ trunk/tools/dstat/plugins/dstat_mysql_io.py 2007-08-10 20:41:10 UTC (rev 5707)
@@ -0,0 +1,44 @@
+global string, select
+import string, select
+
+class dstat_mysql(dstat):
+ def __init__(self):
+ self.name = 'mysql io'
+ self.format = ('f', 5, 1024)
+ self.vars = ('Bytes_received', 'Bytes_sent')
+ self.nick = ('recv', 'sent')
+ self.init(self.vars, 1)
+
+ def check(self):
+ if os.access('/usr/bin/mysql', os.X_OK):
+ try:
+ self.stdin, self.stdout, self.stderr = dpopen('/usr/bin/mysql -n')
+ except IOError:
+ raise Exception, 'Cannot interface with MySQL binary'
+ return True
+ raise Exception, 'Needs MySQL binary'
+
+ def extract(self):
+ try:
+ self.stdin.write("show status like 'Bytes_%';\n")
+ for line in readpipe(self.stdout):
+ l = line.split()
+ if len(l) < 2: continue
+ if l[0] in self.vars:
+ self.cn2[l[0]] = float(l[1])
+
+ for name in self.vars:
+ self.val[name] = (self.cn2[name] - self.cn1[name]) * 1.0 / tick
+
+ if step == op.delay:
+ self.cn1.update(self.cn2)
+
+ except IOError, e:
+ if op.debug: print 'dstat_innodb_buffer: lost pipe to mysql,', e
+ for name in self.vars: self.val[name] = -1
+
+ except Exception, e:
+ if op.debug: print 'dstat_innodb_buffer: exception', e
+ for name in self.vars: self.val[name] = -1
+
+# vim:ts=4:sw=4:et
Added: trunk/tools/dstat/plugins/dstat_mysql_keys.py
===================================================================
--- trunk/tools/dstat/plugins/dstat_mysql_keys.py (rev 0)
+++ trunk/tools/dstat/plugins/dstat_mysql_keys.py 2007-08-10 20:41:10 UTC (rev 5707)
@@ -0,0 +1,44 @@
+global string, select
+import string, select
+
+class dstat_mysql_keys(dstat):
+ def __init__(self):
+ self.name = 'mysql key status'
+ self.format = ('f', 4, 1000)
+ self.vars = ('Key_blocks_used', 'Key_reads', 'Key_writes', 'Key_read_requests', 'Key_write_requests')
+ self.nick = ('used', 'read', 'writ', 'rreq', 'wreq')
+ self.init(self.vars, 1)
+
+ def check(self):
+ if os.access('/usr/bin/mysql', os.X_OK):
+ try:
+ self.stdin, self.stdout, self.stderr = dpopen('/usr/bin/mysql -n')
+ except IOError:
+ raise Exception, 'Cannot interface with MySQL binary'
+ return True
+ raise Exception, 'Needs MySQL binary'
+
+ def extract(self):
+ try:
+ self.stdin.write("show status like 'Key_%';\n")
+ for line in readpipe(self.stdout):
+ l = line.split()
+ if len(l) < 2: continue
+ if l[0] in self.vars:
+ self.cn2[l[0]] = float(l[1])
+
+ for name in self.vars:
+ self.val[name] = (self.cn2[name] - self.cn1[name]) * 1.0 / tick
+
+ if step == op.delay:
+ self.cn1.update(self.cn2)
+
+ except IOError, e:
+ if op.debug: print 'dstat_innodb_buffer: lost pipe to mysql,', e
+ for name in self.vars: self.val[name] = -1
+
+ except Exception, e:
+ if op.debug: print 'dstat_innodb_buffer: exception', e
+ for name in self.vars: self.val[name] = -1
+
+# vim:ts=4:sw=4:et
More information about the svn-commits
mailing list