I have to calculate total capacity remaining for nodes. I am using subquery to get the sum of last values of two values separately - total usage and total capacity into two new different measurements. Would it be able to calculate difference from these two measurements ? or can this be done from single query ?
Calculating total capcaity -
select sum(last) into “tier0_total_total” from (SELECT last(“value”) FROM “ofstat_value” WHERE “type_instance” = ‘tier0_total’ and host=~ /.*/ and instance = ‘null’ GROUP BY host)
calculating total usage-
select sum(last) into “tier0_inuse_total” from (SELECT last(“value”) FROM “ofstat_value” WHERE “type_instance” = ‘tier0_inuse’ and host=~ /.*/ and instance = ‘null’ GROUP BY host)
Now I need to find the difference from these two measurements “tier0_total_total”, “tier0_inuse_total”.
Any help is appreciated