Search code examples
prometheusgrafanapromqlgraphing

Plot a pie chart based on counters in grafana


Let's Say I have 3 counters c1,c2,c3. I need to plot a pie-chart in grafana using these counters. c1/(c1+c2+c3), c2/(c1+c2+c3) and c3/(c1+c2+c3) covering the area of pie-chart. Can some one help with promQl query to plot the same.


Solution

  • We just need to add queries for each counter and it will plot it in pie-chart.

    select visualization as pie-chart.

    q1:sum_over_time(c1{}[$__interval])
    q2:sum_over_time(c2{}[$__interval])
    q3:sum_over_time(c3{}[$__interval])