[tools] date/time output to csv - dstat_time instance has no attribute 'val'

Dag Wieers dag at wieers.com
Fri Feb 9 08:21:43 CET 2007


On Thu, 8 Feb 2007, VK wrote:

> Using dstat-0.6.4-1 on both RHEL 3 and RHEL 4, I noticed the date/time option
> is problematic when output is to a csv file:
> 
> # dstat -tvf --output /tmp/dstat.csv
> Terminal width too small, trimming output.
> -----time----- ---procs--- ------memory-usage----- ---paging-- ---system-->
>   date/time   |run blk new| used  buff  cach  free|  in   out | int   csw 
> >
> Traceback (most recent call last):
>   File "/usr/bin/dstat", line 1928, in ?
>     main()
>   File "/usr/bin/dstat", line 1879, in main
>     oline = oline + o.showcsv() + o.showcsvend(totlist, vislist)
>   File "/usr/bin/dstat", line 411, in showcsv
>     if isinstance(self.val[name], types.ListType) or
> isinstance(self.val[name], types.TupleType):
> AttributeError: dstat_time instance has no attribute 'val'
> #
> 
> 
> but it's fine with epoch time:
> 
> # dstat -Tvf --output /tmp/dstat.csv
> Terminal width too small, trimming output.
> --epoch--- ---procs--- ------memory-usage----- ---paging-- ---system-->
>   epoch   |run blk new| used  buff  cach  free|  in   out | int   csw >
> 1170348933|  0   0  31|5147M   84M 1920M  667M|1257B 1197B|1616  1564 >
> 1170348934|  0   0  27|5147M   84M 1920M  667M|   0     0 |1216   847 >
> 
> #
> 
> 
> Any idea what the issue is?

Yes, a genuine bug :(

The problem is related with the fact that everything is a real counter, 
except the dstat_time output, which is just a string.

The only other plugin that outputs a string is the app plugin and it 
suffers from the same problem.

This was probably introduced when I simplified some of the backend code 
and I can honestly say that I didn't test the CSV functionality :/

I fixed it in subversion and a new release is imminent.

The dstat_app plugin currently outputs ANSI characters in CSV, which is 
something that is still to be fixed.

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]


More information about the tools mailing list