Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphite - create graph with percentage

I am trying to create a graph as show below which was described in blog post(http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitoring/)

what im looking for

However I cannot get the values to "stack" on top of each other. They are overlapping each other. My example:

My example

The is my graph data:

enter image description here

Graph after using "stacked" - not quite what I was looking for enter image description here

like image 525
Noel Avatar asked Jan 20 '14 23:01

Noel


1 Answers

You were fairly close to it. :)

In the Graphite web-app, follow Graph Options -> Line Mode -> Stacked. In case you're rendering using the API, add &areaMode=stacked to your URL.


This is the GUI tweak to achieve what you want. To generate the metrics, do-

asPercent(
      group(
             carbon.agents.ip-10-0-0-111-a.updateOperations,
             carbon.agents.ip-10-0-0-111-a.metricsReceived
      ),
      sumSeries(
             carbon.agents.ip-10-0-0-111-a.updateOperations,
             carbon.agents.ip-10-0-0-111-a.metricsReceived
      )
)

This is how it works-

asPercent takes two arguments- a seriesList and a total. Here, the group(...) part is the former and sumSeries(...) the latter. Graphite compares each metric in the seriesList ( which can be achieved by group() or by using wildcards) with the total and hence calculates percentages.

The good part is that total is an optional and if not sent is assumed to be the total of seriesList. So in essence, your metric is reduced to-

asPercent(
      group(
             carbon.agents.ip-10-0-0-111-a.updateOperations,
             carbon.agents.ip-10-0-0-111-a.metricsReceived
      )
) 

enter image description here

like image 191
erbdex Avatar answered Oct 16 '22 02:10

erbdex