Permalink
Browse files

Backport to python 1.5, document changes

  • Loading branch information...
1 parent de8d096 commit b9bb284c9bab59314536f851be9edabd2b35d7a4 @dagwieers committed May 23, 2005
Showing with 228 additions and 145 deletions.
  1. +12 −12 ChangeLog
  2. +11 −7 README.plugins
  3. +13 −11 TODO
  4. +13 −10 dstat
  5. +156 −101 dstat15
  6. +4 −1 plugins/dstat_battery.py
  7. +4 −1 plugins/dstat_cpufreq.py
  8. +8 −1 plugins/dstat_freespace.py
  9. +3 −0 plugins/dstat_postfix.py
  10. +4 −1 plugins/dstat_thermal.py
View
@@ -14,25 +14,25 @@
- Added initial values (step=0) for disk, int, page, and sys stats
- Allowed external tools to use the dstat classes
- Added example scripts using the dstat classes (mstat.py and read.py)
-- Allowed external modules to be plugged in
-- Added external acpi module dstat_battery
-- Added external acpi module dstat_cpufreq
-- Added external acpi module dstat_thermal)
-- Added external app module dstat_postfix
-- Added external app module dstat_sendmail
-- Added external module dstat_dbus
-- Added external module dstat_freespace
-- Added external module dstat_utmp
-- Removed user stat (now in dstat_utmp module)
+- Allowed external plugins to be plugged in
+- Added external acpi plugin dstat_battery
+- Added external acpi plugin dstat_cpufreq
+- Added external acpi plugin dstat_thermal
+- Added external app plugin dstat_postfix
+- Added external app plugin dstat_sendmail
+- Added external plugin dstat_dbus
+- Added external plugin dstat_freespace
+- Added external plugin dstat_utmp
+- Removed user stat (now in external dstat_utmp plugin)
- Smaller fixes and overall improvements
- Improved help output and manpage
-- Added README.examples, README.performance and README.stats
+- Added README.examples, README.performance and README.plugins
- Added profiling/debuging code (--debug)
- Rewrote cprint/cprintlist logic
- Get rid of python-curses requirement for SLES9 (although it helps)
- Fixed dstat_disk24old for newer 2.4 kernels without CONFIG_BLK_STATS support (Susan G. Kleinmann)
- Improved dstat_disk24 for newer 2.4 kernels with CONFIG_BLK_STATS support (Susan G. Kleinmann)
-- Allow for specifying compatible stats on command line (eg. -M disk24,page24)
+- Allow for specifying compatible stats on command line (eg. -M disk24,disk24old,page24)
- Make time stat more detailed when --debug is used.
* 0.5.10 - released 08/04/2005
View
@@ -1,12 +1,15 @@
-External dstat modules
+External dstat plugins
""""""""""""""""""""""
The core functionality of dstat is self-contained inside the dstat script,
-but it is possible to add your own dstat modules. Currently only the
-following external modules exist:
+but it is possible to add your own dstat plugins. Currently only the
+following external plugins exist:
dstat_battery
dstat_cpufreq
dstat_dbus
+ dstat_freespace
+ dstat_postfix
+ dstat_sendmail
dstat_thermal
dstat_utmp
@@ -16,21 +19,22 @@ You can enable one of these stats by using the -M options:
Currently I foresee that all stats that depend on something else than
just the kernel or the stock python modules are implemented as external
-modules. Also experimental modules or modules that are expensive should
+plugins. Also experimental plugins or plugins that are expensive should
be external.
-Future possible external modules:
+Future possible external plugins:
dstat_amavisd
dstat_apache
dstat_bind
+ dstat_cifs
dstat_dhcpd
dstat_dnsmasq
dstat_gfs
dstat_gpfs (needs a fast /proc interface)
dstat_nfs
- dstat_postfix
dstat_qla2300
dstat_samba (needs a python tdb implementation)
- dstat_sendmail
dstat_squid
+
+Please send feedback to: <dag@wieers.com>
View
@@ -9,11 +9,11 @@
+ Allow for different types of export modules (only CSV now)
### Extending statistics (help welcome!)
-+ Add slab stats (see /proc/slabinfo and slabtop)
-+ Add xorg stats (xdpyinfo, xrestop)
-+ Add icmp, nfs, ntp stats ?
-+ Add application stats (-a or -A pid,cmd)
-+ Add user stats (number of users logged on, utmp is not that useful, /proc/key-users)
++ Add slab plugin (see /proc/slabinfo and slabtop)
++ Add xorg plugin (xdpyinfo, xrestop)
++ Add icmp, nfs, ntp plugin ?
++ Add application plugin (-a or -A pid,cmd)
++ Add user plugin (number of users logged on, utmp is not that useful, /proc/key-users)
+ Look into interfacing with apps (bind, sendmail, postfix, squid, amavisd, laus, samba)
+ Look into interfacing with specific HW counters in /proc
+ Look at /proc/meminfo, /proc/mdstat, /proc/netstat, /proc/snmp, /proc/vmstat
@@ -29,15 +29,16 @@
(explaining the different uses of tools like dstat, iostat, pmap, strace, tcpdump)
### General bugs
-+ Timer is not accurate on 2.6 kernel, every 1 seconds there's a 0.8ms deviation (every 21mins -> 1sec)
++ Timer is not as accurate on 2.6 kernel as on 2.4, possibly scheduling differences
+ Python 1.5 prints 'L' for long, crashes when int()
+ If number of lines on terminal <= 1, division by zero
-
-### Stat bugs
+ Implement better (?) protection against counter rollovers
-+ tcp stat is very slow and generates lots of softirqs (on busy systems), to be confirmed
-+ proc stats (run and blk) does not work on 2.4.24+
-+ proc stats seem to be off-by-one compared to vmstat (some of the time, this is what I get from /proc/stat)
++ Plugins currently have to be written in python 1.5 to work for dstat15 (lowest common denominator)
+
+### Plugin bugs
++ tcp plugin is very slow and generates lots of softirqs (on busy systems), to be confirmed
++ proc plugin (run and blk) does not work on 2.4.24+, to be confirmed
++ proc plugin seem to be off-by-one compared to vmstat (some of the time, this is what I get from /proc/stat)
+ /proc/partitions can have negative numbers, seen on systems with long uptime. dstat handles this except for calculating the very first stat, no work-around possible?
### Redesign (v2.0)
@@ -53,3 +54,4 @@
+ Design proper object model and namespace for _all_ possible stats
+ Create a seperate screen-based tool, much like nmon (dstat is line-based)
++ Create client/server monitoring tool
View
@@ -596,7 +596,6 @@ class dstat_disk24(dstat):
self.vars = self.vars()
if self.fd and not self.discover():
raise Exception, 'kernel is not compiled with CONFIG_BLK_STATS'
-# info(1, 'dstat_disk24: kernel is lacking disk stat support, please compile CONFIG_BLK_STATS into your kernel')
self.name = ['disk/'+sysfs_dev(name) for name in self.vars]
self.init(self.vars + ['total',], 2)
@@ -718,7 +717,8 @@ class dstat_disk24old(dstat):
for set in self.vars:
if set in op.diskset.keys():
for disk in op.diskset[set]:
- self.cn2[set] = ( self.cn2[set][0] + long(l[2]), self.cn2[set][1] + long(l[3]) )
+ if re.match('^'+disk+'$', name):
+ self.cn2[set] = ( self.cn2[set][0] + long(l[2]), self.cn2[set][1] + long(l[3]) )
break
for name in self.cn2.keys():
self.val[name] = (
@@ -1286,8 +1286,8 @@ def ticks():
def dopen(file):
global fds
if not os.path.exists(file): return None
- if 'fds' not in globals(): fds = {}
- if file not in fds:
+ if 'fds' not in globals().keys(): fds = {}
+ if file not in fds.keys():
fds[file] = open(file, 'r', 0)
else:
fds[file].seek(0)
@@ -1515,7 +1515,7 @@ def signaler(signum, frame):
def exit(ret):
sys.stdout.write(ansi['reset'])
- if 'signal' in sys.modules:
+ if 'signal' in sys.modules.keys():
signal.signal(signal.SIGALRM, signal.SIG_DFL)
# termios.tcsetattr(fd, termios.TCSADRAIN, old)
sys.exit(ret)
@@ -1547,7 +1547,7 @@ def main():
### Check terminal capabilities
if sys.stdout.isatty():
- if 'curses' in sys.modules and curses.tigetnum('colors') < 0:
+ if 'curses' in sys.modules.keys() and hasattr(curses, 'tigetnum') and curses.tigetnum('colors') < 0:
op.color = False
else:
op.color = False
@@ -1577,16 +1577,19 @@ def main():
else: mods = ( module, )
for mod in mods:
- if 'dstat_'+mod not in globals():
+ if 'dstat_'+mod not in globals().keys():
try:
import imp
file, pathname, description = imp.find_module('dstat_'+mod)
- exec(compile(readfile(pathname), '<string>', 'exec'))
+# exec compile(readfile(pathname), pathname, 'exec')
+ execfile(pathname)
except Exception, e:
- info(1, 'Module "dstat_%s" failed to load. (%s)' % (mod, e))
+ info(1, 'Module dstat_%s failed to load. (%s)' % (mod, e))
continue
+
try:
- exec(compile('o = dstat_%s()' % mod, '<string>', 'exec'))
+# exec compile('o = dstat_%s()' % mod, '<string>', 'single')
+ exec 'o = dstat_%s()' % mod
### Remove defect stat objects and calculate line length
if o.check():
Oops, something went wrong. Retry.

0 comments on commit b9bb284

Please sign in to comment.