Very new to DB technology and SQL but I've been trying to create a table using Flux that scrapes from multiple Prometheus data sources. Each row needs to represent a single Prometheus source with each column representing data points such as CPU usage, memory usage, etc...
from(bucket: "BUCKET")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "prometheus")
|> filter(fn: (r) =>
r._field == "process_num_threads" or
r._field == "system_runtime_cpu_usage" or
r._field == "dotnet_total_memory_bytes" or
r._field == "system_net_sockets_bytes_received" or
r._field == "system_net_sockets_bytes_sent"
)
|> aggregateWindow(every: 15s, fn: last, createEmpty: true)
|> pivot(rowKey: ["name"], columnKey: ["_field"], valueColumn: "_value")
|> drop(columns: ["_start","_stop","host","type","_measurement","url"])
So far, i've been able to query each source with a unique tag but influxDB is showing every row as a separate table! I would like for each source to display as a single row one after the other in a single table.
what I want:
Thank you in advanced for the help!
Found that 'group' accomplished exactly what I was looking for!