Aggregate function mean,nonsupport select mean(cached+buffered+used)/total*100 from mem such aggregation operations

Hi guys,
I have a tough nut to crack,MEM information stored in the infuxdb database,There are cached columns and buffered and used columns and free columns and total columns,The Linux system reads and writes caching mechanisms that treat the cache and buffer parts of memory as available memory.
Because the environment is running in a special program, the cache part is not available,Therefore, monitoring should also follow the adjustment,Treat the cache part of memory as an unusable part.

but,In grafana Such SQL statements are not supported:
select mean(cached+buffered+used)/total*100 from mem where host=‘hostA’ or host=‘hostB’ AND $timeFilter group by time($interval) fil(null) #(Calculates the percentage of memory usage for multiple hosts)

Can you help me with the problem of this statement?


You mean the query works in InfluxDB? Click on the hamburger menu in the right side of the query (In Grafana Metrics tab UI), then switch editor mode, this will give you text box for the influxdb query, you can not specify any query you wish

Hi Torkel,
This query is also invalid in influxdb,What method or change the syntax, can achieve such a demand。

source statement:
select mean(used_percent) from “autogen”.“mem” where host = ‘hostA’ ot host = ‘hostB’ AND $timeFilter group by time($interval) fill(null) ##grafana Metrics UI configurable

after changing:
select mean(cached+buffered+used)/total*100 from “autogen”.“mem” where host=‘hostA’ or host=‘hostB’ AND $timeFilter group by time($interval) fill(null) ##cached,buffered,used,used_percent,total these columns In the influxdb MEM table is there.

another,This statement is supported in the influxdb database:


Don’t think InfluxDB supports what you want to do

Is it possible to implement this requirement in grafana?

Sadly no, it has to be done by InfluxDB