4

My servers send mem_total and mem_free metrics to Graphite, but I'd like to display mem_used on my dashboard. I'm currently solving the problem by doing:

offset(scale(servers.foo.*.mem_free,-1),30823052)

where 30823052k is the total memory.

I'm wondering if there's a way that I can leverage graphite to calculate mem_used from mem_total and mem_free for me, so that I can avoid having to hard-code the amount of total memory in my query?

I have been doing some testing with Grafana lately, and have figured out a partial solution, which is:

A) servers.foo.server1.mem_total (mark invisible)
B) servers.foo.server1.mem_free (mark invisible)
C) diffSeries(#A, #B)

but, this solution only works without wildcards - and I really really want to be able to use wildcards rather than having to do this kind of thing for every single server.

I was looking at the available functions, and groupByNode seems like it might be a part of the solution I'm looking for, but I haven't figured out a way to do what I want with it yet.

phrend
  • 41
  • 1
  • 4
  • KarlHungus on freenode in #graphite pointed out that the latest version of graphite supports Map/Reduce functions: http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions.reduceSeries – phrend May 28 '15 at 21:08

1 Answers1

2

You can do so using mapSeries and reduceSeries.

reduceSeries(mapSeries(servers.foo.*.*,2),"diffSeries",3,"mem_total","mem_free")
Fusl
  • 3
  • 1
kelunik
  • 203
  • 2
  • 13