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
)
)