Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates

  • Loading branch information...
commit c3f1b16a32c453cf472f0230336c05801a89da59 1 parent 4dde308
@dagwieers authored
View
2  ChangeLog
@@ -11,6 +11,8 @@
- Fixed a few inaccuracies in the man page. (John Goggan)
- Fixed opening vanished files in /proc in dstat_topcpu.
- Fixed formatting bug in dstat_topcpu.
+- Added external dstat_mysql_* and dstat_innodb_* plugins
+- Added greppipe() and matchpipe() to improve performance on pipe-handling
- Added external dstat_topio and dstat_topbio plugins
* 0.6.6 - Unemployed - released 28/04/2007
View
1  TODO
@@ -22,6 +22,7 @@ contact me as well. :) Send an email to: Dag Wieers <dag@wieers.com>
+ Allow for different types of export modules (only CSV now)
+ Allow to write out to syslog (or remote syslog)
+ Allow to write unbuffered to disk
++ Write out user input to CSV
### Plugin improvements
+ Don't calculate counters twice when a plugin is loaded twice
View
67 docs/dstat.1.txt
@@ -1,21 +1,17 @@
-dstat(1)
-========
+= dstat(1)
Dag Wieers <dag@wieers.com>
v0.6.4, December 2006
-NAME
-----
+== NAME
dstat - versatile tool for generating system resource statistics
-SYNOPSIS
---------
+== SYNOPSIS
dstat [-afv] [options..] [delay [count]]
-DESCRIPTION
------------
+== DESCRIPTION
Dstat is a versatile replacement for vmstat, iostat and ifstat. Dstat
overcomes some of the limitations and adds some extra features.
@@ -42,8 +38,7 @@ datastat to avoid a name conflict. See Debian bug #283709 for more
information.
-OPTIONS
--------
+== OPTIONS
-c, --cpu::
enable cpu stats
@@ -148,8 +143,7 @@ Possible external plugin stats can be listed using::
write CSV output to file
-ARGUMENTS
----------
+== ARGUMENTS
*delay* is the delay in seconds between each update
*count* is the number of updates to display before exiting
@@ -157,8 +151,7 @@ ARGUMENTS
The default delay is 1 and count is unspecified (unlimited)
-INTERMEDIATE UPDATES
---------------------
+== INTERMEDIATE UPDATES
When invoking dstat with a *delay* greater than 1 and without the
*--noupdate* option, it will show intermediate updates, ie. the first
time a 1 sec average, the second update a 2 second average, etc. until
@@ -170,8 +163,7 @@ the last final update. The end result is that you get a 10 second
average on a new line, just like with vmstat.
-USAGE
------
+== USAGE
Using dstat to relate disk-throughput with network-usage (eth0), total CPU-usage and system counters:
----
dstat -dnyc -N eth0 -C total -f 5
@@ -197,8 +189,7 @@ dstat -tcyif
----
-BUGS
-----
+== BUGS
Since it's practically impossible to test dstat on every possible
permutation of kernel, python or distribution version, I need your
help and your feedback to fix the remaining problems. If you have
@@ -209,8 +200,7 @@ mailto:dag@wieers.com[]
Please see the TODO file for known bugs and future plans.
-FILES
------
+== FILES
Paths that may contain external dstat_* plugins:
~/.dstat/
@@ -221,51 +211,40 @@ Paths that may contain external dstat_* plugins:
/usr/local/share/dstat/
-SEE ALSO
---------
-Performance tools
-~~~~~~~~~~~~~~~~~
+== SEE ALSO
+
+=== Performance tools
ifstat(1), iftop(8), iostat(1), mpstat(1), netstat(1), nfsstat(1), nstat, vmstat(1), xosview(1)
-Debugging tools
-~~~~~~~~~~~~~~~
+=== Debugging tools
htop, lslk(1), lsof(8), top(1)
-Process tracing
-~~~~~~~~~~~~~~~
+=== Process tracing
ltrace(1), pmap(1), ps(1), pstack(1), strace(1)
-Binary debugging
-~~~~~~~~~~~~~~~~
+=== Binary debugging
ldd(1), file(1), nm(1), objdump(1), readelf(1)
-Memory usage tools
-~~~~~~~~~~~~~~~~~~
+=== Memory usage tools
free(1), memusage, memusagestat, slabtop(1)
-Accounting tools
-~~~~~~~~~~~~~~~~
+=== Accounting tools
dump-acct, dump-utmp, sa(8)
-Hardware debugging tools
-~~~~~~~~~~~~~~~~~~~~~~~~
+=== Hardware debugging tools
dmidecode, ifinfo(1), lsdev(1), lshal(1), lshw(1), lsmod(8), lspci(8), lsusb(8), smartctl(8), x86info(1)
-Application debugging
-~~~~~~~~~~~~~~~~~~~~~
+=== Application debugging
mailstats(8), qshape(1)
-Xorg related tools
-~~~~~~~~~~~~~~~~~~
+=== Xorg related tools
xdpyinfo(1), xrestop(1)
-Other useful info
-~~~~~~~~~~~~~~~~~
+=== Other useful info
proc(5)
-AUTHOR
-------
+== AUTHOR
Written by Dag Wieers mailto:dag@wieers.com[]
Homepage at http://dag.wieers.com/home-made/dstat/[]
View
7 plugins/dstat_topbio.py
@@ -48,7 +48,9 @@ def extract(self):
if len(l) != 2: continue
self.cn2[pid][l[0]] = int(l[1])
- except ValueError or IOError:
+ except ValueError:
+ continue
+ except IOError:
continue
read_usage = (self.cn2[pid]['read_bytes:'] - self.cn1[pid]['read_bytes:']) * 1.0 / tick
@@ -81,7 +83,8 @@ def extract(self):
# self.val['process'] = '%*s %-*s' % (5, self.val['pid'], self.format[1]-6, self.val['name'])
if step == op.delay:
- self.cn1.update(self.cn2)
+ for pid in self.cn2.keys():
+ self.cn1[pid].update(self.cn2[pid])
def show(self):
if self.val['usage'] == 0.0:
View
18 plugins/dstat_topcpu.py
@@ -31,6 +31,11 @@ def extract(self):
if len(l) < 15: continue
+ ### Get commandline
+ m = string.split(open('/proc/%s/cmdline' % pid).read(), '\0')
+ if len(m) > 1:
+ cmd = os.path.basename(m[1])
+
### Reset previous value if it doesn't exist
if not self.cn1.has_key(pid):
self.cn1[pid] = 0
@@ -38,7 +43,9 @@ def extract(self):
self.cn2[pid] = int(l[13]) + int(l[14])
usage = (self.cn2[pid] - self.cn1[pid]) * 1.0 / tick
- except ValueError or IOError:
+ except ValueError:
+ continue
+ except IOError:
continue
### Get the process that spends the most jiffies
@@ -46,7 +53,8 @@ def extract(self):
self.val['usage'] = usage
self.val['name'] = l[1][1:-1]
self.val['pid'] = pid
- st = os.stat("/proc/%s" % pid)
+ self.val['cmd'] = cmd
+# st = os.stat("/proc/%s" % pid)
# if st:
# pw = pwd.getpwuid(st.st_uid)
# if pw:
@@ -61,11 +69,7 @@ def extract(self):
else:
### If the name is a known interpreter, take the second argument from the cmdline
if self.val['name'] in ('bash', 'csh', 'ksh', 'perl', 'python', 'sh'):
- ### Using dopen() will cause too many open files
-# l = string.split(dopen('/proc/%s/cmdline' % self.val['pid']).read(), '\0')
- l = string.split(open('/proc/%s/cmdline' % self.val['pid']).read(), '\0')
- if len(l) > 2:
- self.val['process'] = os.path.basename(l[1])
+ self.val['process'] = os.path.basename(cmd)
else:
self.val['process'] = self.val['name']
View
7 plugins/dstat_topio.py
@@ -48,7 +48,9 @@ def extract(self):
if len(l) != 2: continue
self.cn2[pid][l[0]] = int(l[1])
- except ValueError or IOError:
+ except ValueError:
+ continue
+ except IOError:
continue
read_usage = (self.cn2[pid]['rchar:'] - self.cn1[pid]['rchar:']) * 1.0 / tick
@@ -83,7 +85,8 @@ def extract(self):
# self.val['process'] = '%*s %-*s' % (5, self.val['pid'], self.format[1]-6, self.val['name'])
if step == op.delay:
- self.cn1.update(self.cn2)
+ for pid in self.cn2.keys():
+ self.cn1[pid].update(self.cn2[pid])
def show(self):
if self.val['usage'] == 0.0:
View
4 plugins/dstat_topmem.py
@@ -32,7 +32,9 @@ def extract(self):
if len(l) < 23: continue
usage = int(l[23]) * pagesize
- except ValueError or IOError:
+ except ValueError:
+ continue
+ except IOError:
continue
### Get the process that uses the most memory
Please sign in to comment.
Something went wrong with that request. Please try again.