from(bucket: “telegraf”)
|> range(start: -30m)
|> filter(fn: ® => r._measurement == “mem”)
|> filter(fn: ® => r._field == “used”)
|> aggregateWindow(every: 10m, fn: max)
|> tail(n: 3, offset: 1)
|> pivot(rowKey:[“host”], columnKey: ["_field", “_time”], valueColumn: “_value”)
I’m trying to do some comparisons of memory over time. I can’t work with the timestamp in the column name though. I was trying to add a column with the row index so i could pivot on that instead of time. Any ideas?
#group | FALSE | FALSE | TRUE | TRUE | TRUE | TRUE | FALSE | FALSE | FALSE |
---|---|---|---|---|---|---|---|---|---|
#datatype | string | long | dateTime:RFC3339 | dateTime:RFC3339 | string | string | long | long | long |
#default | _result | ||||||||
result | table | _start | _stop | _measurement | host | used_2019-11-09T09:00:00.000000000Z | used_2019-11-09T09:10:00.000000000Z | used_2019-11-11T22:10:00.000000000Z | |
0 | 2019-11-08T22:10:17.534303843Z | 2019-11-11T22:10:17.534303843Z | mem | host1 | 918052864 | 917450752 | 846524416 | ||
1 | 2019-11-08T22:10:17.534303843Z | 2019-11-11T22:10:17.534303843Z | mem | host2 | 7565942784 | 7548379136 | 6653722624 |
Thanks