@Silva Each of what you are calling “measurements” are actually being stored as fields in influx. Also what you are calling a “series” is actually a measurement in influx. Math between fields in a measurement is supported in InfluxDB. Can you share the queries that you have tried?
I updated the post with the changes that you told me.
I tried using JOINs but Influx don’t support that command, and I don’t know other way to do it.
I have to substact the outcome of these 2 queries:
SELECT StorageUsed*StorageAllocationUnit FROM "Storage" WHERE hostname = 'agent01' where "Device" = 'Physical memory';
SELECT StorageUsed*StorageAllocationUnit FROM "Storage" WHERE hostname = 'agent01' where "Device" = 'Cached memory';
Like this:
SELECT (SELECT StorageUsed*StorageAllocationUnit from "Storage" where "hostname" = 'agent01' and "Device" = 'Cached memory') - (SELECT StorageUsed*StorageAllocationUnit from "Storage" where "hostname" = 'agent01' and "Device" = 'Physical memory') as Difference
Looking for the same - one measurement math between 2 fields (both calculated by non_neg_derivative).
SELECT “compress” FROM (SELECT (non_negative_derivative(mean(“bytes_recv”), 1s) *8 WHERE “interface” = ‘eth1’) - (non_negative_derivative(mean(“bytes_sent”), 1s)*8 WHERE “interface” = ‘eth2’) as “compress” FROM “net” WHERE “host” = ‘ovpn1’ AND $timefilter GROUP BY time($interval))
I have exactly same problem. I need some kind of way to do math between fields.
I use telegraf to collect CPU and memory data from various types of devices via SNMP. I have no problem writing data to InfluxDB and Elasticserch and later I use queries to calculate percents. But problem is that various device report these types of metrics differently. Some report used memory + free memory, some used memory + all memory and etc. So I end up having to put up to 10 different queries in Grafana just to make universal dashboard for memory.
I am also trying in similar kind of Quires , My intention is to Calculate “Physical Memory excluding Buffer ,Cache and Shared memories” from SNMP Data. can any one help us on this ??
Hello. From what I’ve attempted it seems you must include a function for each field. Lets say you want to subtract the sum of two fields, fieldA and fieldB. To do this you must use the functions as follows: SELECT sum("fieldA") - sum("fieldB")
An incorrect way of attempting this would be: SELECT sum("fieldA"-"fieldB")
Hope this helps anyone who stumbles on this thread. I know it’s a little late for OP and others.