# Plot cum sum metric

**URL:** <https://discuss.elastic.co/t/plot-cum-sum-metric/124730>\
**Category:** Kibana\
**Created:** [March 20, 2018, 10:23am UTC](https://discuss.elastic.co/t/plot-cum-sum-metric/124730 "2018-03-20T10:23:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eirc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eirc/32/11769_2.png) [@eirc](https://discuss.elastic.co/u/eirc)\
**Post date:** [March 20, 2018, 10:23am UTC](https://discuss.elastic.co/t/plot-cum-sum-metric/124730/1 "2018-03-20T10:23:28Z")

</div>

Hello,

I recently setup metricbeat to monitor various metrics over various hosts and I find it very tricky to plot metrics that come in a cumulative sum form like network bytes in any of the visualization options.

I can use a derivative or a serial diff aggregation to plot the change of the metric but when these metrics' cum sum resets I get a negative value in the aggregation result. I can avoid plotting the negative value with:

- Setting the axis' min value to 0 on standard visualisations
- Using positive only on TSVB
- Using an if on timelion

but I still get a zero in these cases and combining for example lots of hosts' network traffics in a plot the zero adds a ton of noise to the graph. Is there any other trick to avoid this?

I was thinking maybe I could calculate the rate value in logstash and drop negative values results there. Any pointers on how to do this maybe or any other solution?

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [March 20, 2018, 12:05pm UTC](https://discuss.elastic.co/t/plot-cum-sum-metric/124730/2 "2018-03-20T12:05:37Z")

</div>

You already mentioned pretty much all of the options you are having 🙂

You could of course calculate this pre-indexing and using logstash or any other solution.

If you want to stick with the data you are having, and you are just annoyed by the noise of all the 0 values, you could use timelion's `if` and instead of setting it to `0` setting it to `null`. That way that point should vanish from the graph altogether.

Cheers,  
Tim

---

<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:** [April 17, 2018, 12:05pm UTC](https://discuss.elastic.co/t/plot-cum-sum-metric/124730/3 "2018-04-17T12:05:42Z")

</div>

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