Create time series visualizations with Timelionedit
To compare the real-time percentage of CPU time spent in user space to the results offset by one hour, create a time series visualization.
Define the functionsedit
To start tracking the real-time percentage of CPU, enter the following in the Timelion Expression field:
.es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct')
![timelion create01](images/timelion-create01.png)
Compare the dataedit
To compare the two data sets, add another series with data from the previous hour, separated by a comma:
.es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct'), .es(offset=-1h, index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct')
|
![timelion create02](images/timelion-create02.png)
Add label namesedit
To easily distinguish between the two data sets, add the label names:
.es(offset=-1h,index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct').label('last hour'), .es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct').label('current hour')
![timelion create03](images/timelion-create03.png)
Add a titleedit
Add a meaningful title:
.es(offset=-1h, index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('last hour'), .es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('current hour') .title('CPU usage over time')
|
![timelion customize01](images/timelion-customize01.png)
Change the chart typeedit
To differentiate between the current hour data and the last hour data, change the chart type:
.es(offset=-1h, index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('last hour') .lines(fill=1,width=0.5), .es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('current hour') .title('CPU usage over time')
|
![timelion customize02](images/timelion-customize02.png)
Change the line colorsedit
To make the current hour data stand out, change the line colors:
.es(offset=-1h, index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('last hour') .lines(fill=1,width=0.5) .color(gray), .es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('current hour') .title('CPU usage over time') .color(#1E90FF)
|
![timelion customize03](images/timelion-customize03.png)
Make adjustments to the legendedit
Change the position and style of the legend:
.es(offset=-1h, index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('last hour') .lines(fill=1,width=0.5) .color(gray), .es(index=metricbeat-*, timefield='@timestamp', metric='avg:system.cpu.user.pct') .label('current hour') .title('CPU usage over time') .color(#1E90FF) .legend(columns=2, position=nw)
|
![timelion customize04](images/timelion-customize04.png)