I am using Prometheus database to store data of switches. Each switch has a “ramFree” and a “ramUsed” column that contains an amount of bytes. What I want to do is perform a simple math operation to get the percentage of used ram for each switch by doing the following equation:
(ramUsed / (ramFree + ramUsed)) * 100
I am able to do this using the “Math Expression” feature after the query, but it only works when querying for one specific switch. What I want is to have it perform the math operation for each switch (or instance) returned in the query and display the percentage result for each switch (instance) on the graph panel. If I have it do the expression when the query returns more than one switch, it shows a “No data” error.