I have multiple counters in same measurement object need to be aggregated by different way. How I can merge them into one table?
for example:
- Monitor CPU and input maximum CPU, minimum CPU, sum CPU every 1 minutes.
- Need to generate report every 15 minutes including aggregated maximum CPU via max(), minimum CPU via min(), average CPU via sum() during 15 minutes.
influx query --org rcppm -t pm9passwd ’
gauge = from(bucket:“pm9gp”)
|> range(start: -15m30s)
|> filter(fn: (r) =>
r._measurement == “omes2002” and
r._field == “local_m2002c0001”
)
|> group(columns: [“DN”, “_field”])
|> mean()
|> group(columns: [“_measurement”])
|> yield()
’
Result: _result
Table: keys:
_start:time _stop:time DN:string _field:string _value:float
2021-02-25T07:17:25.098335009Z 2021-02-25T07:32:55.098335009Z FPNODE-mn-0/FPCPU-0 local_m2002c0001 4.183800000000001
2021-02-25T07:17:25.098335009Z 2021-02-25T07:32:55.098335009Z FPNODE-mn-0/FPCPU-1 local_m2002c0001 4.2288
2021-02-25T07:17:25.098335009Z 2021-02-25T07:32:55.098335009Z FPNODE-mn-0/FPCPU-2 local_m2002c0001 4.6385499999999995
2021-02-25T07:17:25.098335009Z 2021-02-25T07:32:55.098335009Z FPNODE-mn-0/FPCPU-3 local_m2002c0001 3.6403433333333335
influx query --org rcppm -t pm9passwd ’
max = from(bucket:“pm9gp”)
|> range(start: -15m30s)
|> filter(fn: (r) =>
r._measurement == “omes2002” and
r._field == “m2002c0004”
)
|> group(columns: [“DN”, “_field”])
|> max()
|> group(columns: [“_measurement”])
|> yield()
’
Result: _result
Table: keys: [_measurement]
_measurement:string _stop:time _time:time _value:float DN:string _field:string _start:time
omes2002 2021-02-25T07:33:28.263688577Z 2021-02-25T07:30:00.856972319Z 7 FPNODE-mn-0/FPCPU-0 m2002c0004 2021-02-25T07:17:58.263688577Z
omes2002 2021-02-25T07:33:28.263688577Z 2021-02-25T07:25:00.841503070Z 7 FPNODE-mn-0/FPCPU-1 m2002c0004 2021-02-25T07:17:58.263688577Z
omes2002 2021-02-25T07:33:28.263688577Z 2021-02-25T07:20:00.790683513Z 6 FPNODE-mn-0/FPCPU-2 m2002c0004 2021-02-25T07:17:58.263688577Z
omes2002 2021-02-25T07:33:28.263688577Z 2021-02-25T07:25:00.841527254Z 6 FPNODE-mn-0/FPCPU-3 m2002c0004 2021-02-25T07:17:58.263688577Z
influx query --org rcppm -t pm9passwd ’
max = from(bucket:“pm9gp”)
|> range(start: -15m30s)
|> filter(fn: (r) =>
r._measurement == “omes2002” and
r._field == “m2002c0003”
)
|> group(columns: [“DN”, “_field”])
|> min()
|> group(columns: [“_measurement”])
|> yield()
’
Result: _result
Table: keys: [_measurement]
_measurement:string _stop:time _time:time _value:float DN:string _field:string _start:time
omes2002 2021-02-25T07:34:18.372017940Z 2021-02-25T07:25:00.841487957Z 3 FPNODE-mn-0/FPCPU-0 m2002c0003 2021-02-25T07:18:48.372017940Z
omes2002 2021-02-25T07:34:18.372017940Z 2021-02-25T07:25:00.841503070Z 3 FPNODE-mn-0/FPCPU-1 m2002c0003 2021-02-25T07:18:48.372017940Z
omes2002 2021-02-25T07:34:18.372017940Z 2021-02-25T07:25:00.841514391Z 3 FPNODE-mn-0/FPCPU-2 m2002c0003 2021-02-25T07:18:48.372017940Z
omes2002 2021-02-25T07:34:18.372017940Z 2021-02-25T07:25:00.841527254Z 2 FPNODE-mn-0/FPCPU-3 m2002c0003 2021-02-25T07:18:48.372017940Z
influx query --org rcppm -t pm9passwd ’
max = from(bucket:“pm9gp”)
|> range(start: -15m30s)
|> filter(fn: (r) =>
r._measurement == “omes2002” and
r._field == “local_m2002c0002”
)
|> group(columns: [“DN”, “_field”])
|> sum()
|> group(columns: [“_measurement”])
|> yield()
’
Result: _result
Table: keys:
_start:time _stop:time DN:string _field:string _value:float
2021-02-25T07:21:40.287261696Z 2021-02-25T07:37:10.287261696Z FPNODE-mn-0/FPCPU-0 local_m2002c0002 88750
2021-02-25T07:21:40.287261696Z 2021-02-25T07:37:10.287261696Z FPNODE-mn-0/FPCPU-1 local_m2002c0002 88733
2021-02-25T07:21:40.287261696Z 2021-02-25T07:37:10.287261696Z FPNODE-mn-0/FPCPU-2 local_m2002c0002 88715
2021-02-25T07:21:40.287261696Z 2021-02-25T07:37:10.287261696Z FPNODE-mn-0/FPCPU-3 local_m2002c0002 88655
How make it possible? looks Join only supports 2 tables.