Hi All , i’m new with influxdb 2.0 FLUX query , i’m try to create panel of interface lists with speed, status , etc with table view , could any one help please
here example of panel
Welcome to the Grafana forum.
Is the panel shown in your screenshot what you have already created? What have you created thus far and what do you need help with?
If you have already created your queries, it would help to share them and the results you are getting from each.
hi Grant2 , thanks for supporting ,
the screenshot attached is published on grafana website , the help i need is all about the flux query with table view panel
Have you written any queries in Flux? If not, have you worked through setting up the Data explorer in InfluxDB? This (Essential Concepts of Using Flux with InfluxDB - YouTube) might be a decent place to learn the basics.
HI Grant ,
the purpose is display multiple field values from same measurement on the same table row
here example of query so with this code i got all values in same column , which i want them per row displaying
from(bucket: "snmp")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "interface")
|> filter(fn: (r) => r["_field"] == "ifOperStatus" or r["_field"] == "ifSpeed" or r["_field"] == "ifAdminStatus")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> group(columns: ["ifName"] )
|> keep(columns: ["_field","_value","ifDescr"])
I see you posted a more detailed version of your question on the InfluxDB forum. Since this is mainly a question about InfluxDB, let’s see what answers are provided there before diving into the Grafana questions. Usually, once you work out the kinks in Influx data explorer, you just need to copy/paste the Flux query into Grafana and you’ll have the same results.
hi Grant ,
i found the solution by using |> pivot() to alignment different values on same row , check the query
from(bucket: "ltt")
|> range(start: -10m )
|> filter(fn: (r) => r["_measurement"] == "interface")
|> filter(fn: (r) => r["_field"] == "ifSpeed" or r["_field"] == "ifOperStatus" or r["_field"] == "ifAdminStatus" or r["_field"] == "ifMtu")
|> filter(fn: (r) => r["agent_host"] == "192.168.4.33")
|> aggregateWindow(every: 10m , fn: last, createEmpty: false)
|> pivot(
rowKey:["_time"],
columnKey: ["_field"],
valueColumn: "_value"
)
|> group(columns: ["ifName"] )
|> keep(columns: ["ifDescr" ,"ifSpeed","ifOperStatus","ifAdminStatus","ifMtu"])
|> rename(columns: {ifOperStatus: "OpStatus", ifSpeed: "Speed" , ifAdminStatus: "Admin Status", ifMtu:"MTU"})
|> yield(name:"last")
Looks like you solved it. Nice work.