# Timelion graph

**URL:** https://discuss.elastic.co/t/timelion-graph/108503
**Category:** Kibana
**Tags:** timelion
**Created:** [November 21, 2017, 4:28am UTC](https://discuss.elastic.co/t/timelion-graph/108503 "2017-11-21T04:28:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![christianmatira](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@christianmatira](https://discuss.elastic.co/u/christianmatira)
#### Post date: [November 21, 2017, 4:28am UTC](https://discuss.elastic.co/t/timelion-graph/108503/1 "2017-11-21T04:28:29Z")

</div>

Good day,

I am confused on how timelion compiles its graphs when it comes to weekly and monthy aggregation. I have created a graph that uses the sum of the cpus allocated by the user.  
here is the timelion syntax:  
`.es(index=hpc metric=sum:CPUS q=running).fit(nearest).lines(fill=1).lines(stack=true).label(label=Running) .subtract(.value(value=2304),.es(index=hpc metric=sum:CPUS q=running).fit(nearest)).label(label=Idle).lines(stack=true, fill=1)`

 ![Selection_036](https://us1.discourse-cdn.com/elastic/original/3X/0/4/041839d838931166d3e572538b4fa70093e55793.png)

This works if I want to show the real time allocations. however, when I try to see the weekly and monthly allocations, it shows the sum of the past day which shows cpu allocations above the available cpus of the cluster

 ![Selection_037](https://us1.discourse-cdn.com/elastic/original/3X/f/4/f432d0d8d0c9f158e9be26bd6c5e087691cbecbb.png)

Is there a proper way of querying to timelion?

Thanks in advance  
Christian

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [November 21, 2017, 5:07pm UTC](https://discuss.elastic.co/t/timelion-graph/108503/2 "2017-11-21T17:07:38Z")

</div>

> [@christianmatira](#):
>
> .es(index=hpc metric=sum:CPUS q=running).fit(nearest).lines(fill=1).lines(stack=true).label(label=Running) .subtract(.value(value=2304),.es(index=hpc metric=sum:CPUS q=running).fit(nearest)).label(label=Idle).lines(stack=true, fill=1)

Hi Christian, which version of Kibana is this? Your expression has a few syntax problems that gave me errors when I tried with 6.0.

Was there anything changed in the expression between screenshots?

If you want to see weekly and monthly rollups, the way to do that is to change the bucket size in the time graph. The bucket size dropdown is set to "auto" in both of your screenshots, so that might be somewhere to start.

---

<div class="post-metadata">

### Author: ![christianmatira](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@christianmatira](https://discuss.elastic.co/u/christianmatira)
#### Post date: [November 22, 2017, 5:15am UTC](https://discuss.elastic.co/t/timelion-graph/108503/3 "2017-11-22T05:15:36Z")

</div>

Good day,  
I am using kibana 5.5.1.

Thanks for the tip on the buckets. I think I have solved the problem  
On my Timelion syntax I added the interval=4m to solve the issue because I configured mine to collect data every 4 mins  
although I am not sure how this affects the overall results but it seems to show the correct graphs that I want to see.

Here is the new timelion syntax

```
.es(index=hpc metric=sum:CPUS q=running interval=4m).fit(nearest).lines(fill=1).lines(stack=true).label(label=Running) .subtract(.value(value=2304),.es(index=hpc metric=sum:CPUS q=running interval=4m).fit(nearest)).label(label=Idle).lines(stack=true, fill=1)

```

Here is the resulting graph

 ![Selection_041](https://us1.discourse-cdn.com/elastic/original/3X/3/d/3dcb364d8b1fc6a45eaa359db55708e389e4f7f2.png)

Please do tell me if what I did is wrong. I have yet to confirm the accuracy of the graphs shown.

Thanks  
Christian

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 20, 2017, 5:15am UTC](https://discuss.elastic.co/t/timelion-graph/108503/4 "2017-12-20T05:15:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
