Subtract two values with graphite possible?

Hello, i have following problem:
I already show the Windows Server File Share Quota Status on he Grafana Dashboard. I use the pie chart plugin from the plugin library.
The workflow how grafana gets the values are following: icinga2 (check_drivesize via NSClient++) → performance-data → graphite → grafana.
From the check_drive plugin i get only the used and the total value. This means i use two metric lines. One is total and the other is used.
The problem here is that to show the graph correctly i would need the “used” and “free” value but i dont have the free one right now.
So my thinking was that a workaround could be that i subtract used from the total value. Is this possible in grafana?

Edit: Same problem like here: https://community.grafana.com/t/disk-usage-as-percentage-of-used-disk/1499/3

Thank you!

There is a graphite function called substract i think

I could not find a function called “substract” do you have a link or example for me?

It’s called diffSeries

If you’re looking for a solution that fully works in grafana, look at my other post: Disk usage as percentage of used disk - #4 by bjgocraft

Yes, it’s possible to calculate the “free” value in Grafana by subtracting the “used” value from the “total” value. You can achieve this by using Grafana’s query editor to create a new metric.

Here’s a brief outline of how to do it:

  1. Open your Grafana panel where you want to display the data.
  2. Go to the query editor for your data source.
  3. Add a new metric that performs the calculation:
  • If you’re using Graphite, your query could look something like this:

total - used

  • For Prometheus, you can use:

total_metric - used_metric

  1. Create the pie chart using the new “free” value along with the “used” value.