1

I'm trying to build a list of percentages in grafana, but am having trouble getting divideSeries+wildcards to work right.

I found Grafana dividing 2 series which seemed like what I wanted, but unfortunately there's no mapSeries function in my grafana instance (version 4.6.0-1).

This is what I've got, but instead of specifying the ID "1234", I want to use a wildcard, and have each ID grouped together.

divideSeries(stats.dhcp.pools.1234.cur,stats.dhcp.pools.1234.max)

Logically, I tried: divideSeries(stats.dhcp.pools.*.cur,stats.dhcp.pools.*.max) -- but that does not work. I tried mucking around with asPercent, but it has the same limits as divideSeries does.

I think applyByNode is what I want, but I can't seem to translate the example into something that actually works.

tacocat
  • 25
  • 1
  • 5
  • Just a note: Which functions Grafana shows for Graphite depend on your Graphite version. You can change the version in the data source settings if you have a recent version of Graphite installed. – Daniel Lee Nov 27 '17 at 22:29
  • Odd, I'm using the latest graphite-api version (graphite-api-1.1.3-3.el7). From my understanding, graphite-api implements all the graphite-web functions, but I guess I've got a starting point to dig into. – tacocat Nov 29 '17 at 14:11
  • Required installing from the github url: `pip install git+git://github.com/brutasse/graphite-api.git` – tacocat Nov 29 '17 at 14:48
  • In Grafana, there is a version field in the data source settings - you should change that to 1.1.x to see all the new functions. – Daniel Lee Nov 29 '17 at 15:15

1 Answers1

5

You use graphite as datasource (I think). Functions you mentioned are implemented in graphite-web, you can find docs also for applyByNode

applyByNode(
    stats.dhcp.pools.*.*,
    3,
    'divideSeries(%.cur, %.max)',
    '% pct'
)

Note that as of November 2017, applyByNode is not in the default graphite-api install, and requires installation from the github source:

pip install git+git://github.com/brutasse/graphite-api.git

As a side note - you can use any of graphite function, even mapSeries.

tacocat
  • 25
  • 1
  • 5
kwarunek
  • 12,141
  • 4
  • 43
  • 48