In [12]:
%matplotlib inline
from loganalyser import vmstat, plot
In [13]:
cpu = vmstat.parse('data/supercars-oscounters-13102912.tgz', './vmstat.txt.13102912', 'Europe/Berlin')
cpu.head() # note timestamps are in UTC! (workaround for to_json)
Out[13]:
In [14]:
# find out boundaries to select a timeframe -> use ms since epoch
# in a next version boundaries are provided by ipython widgets!
import datetime
from pytz import timezone
print cpu.ix[100]
# proper way with tz http://www.saltycrane.com/blog/2009/05/converting-time-zones-datetime-objects-python/
ts = timezone('Europe/Berlin').localize(datetime.datetime.strptime('2013-10-29 12:53:20', '%Y-%m-%d %H:%M:%S'))
print int(ts.strftime("%s")) * 1000
In [15]:
plot.set_styles(['stacked',])
Out[15]:
In [16]:
plot = reload(plot)
plot.draw_graph('stacked', cpu.to_json(orient='records'),
{'start': 1383047600000, 'end': 1383048600000, 'yaxis': "CPU utilization [%]"})
Out[16]:
In [ ]: