Search code examples
grafanagraphite

grafana - divide series with wildcards


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.


Solution

  • 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.