Needing Help of generating a Timetable on Grafana

Hey everone,

I know it is really a beginner question but I’m scratching my head for a really long time now and don’t know what I’m doing wrong.

For context: I’m on it to create a Grafana Dashboad for my AdGuards like it’s written here. But the Grafanadashboard is not in Flux. I was already able to make my Pie Charts like it’s described, but getting the timetable is not working for me.

For Example my Flux Query is:

from(bucket: "adguard")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["path"] == "/opt/AdGuardHome/data/querylog.json")
  |> drop(columns: ["_start", "_stop"])
  |> group(columns: ["IP24"])
  |> aggregateWindow(every: 1s, fn: last, createEmpty: false)
  |> rename(columns: {_value: ""})
  |> yield(name: "count")

Which generates me this graph:

Yes in that small timeframe I made 8 DNS Requests, but not 2.8G :sweat: IT feels that I miss a small crucial part of understanding in my query to generate the Graph. What am I missing?

An Entry hat the following Columgs:

table, _measurement, _field, _time, _host, _IP, path, QC, QH, QT, TLD, Upstream. An Image can be provided as well if you need it :slight_smile:

Would anybody please help me and enlight what I’m doing wrong? :slight_smile:

Hi @Gamienator and welcome to the Influx forum.

Can you run your Flux query in Influx Data Explorer and view as a table to make sure the data looks as you expect it to? Maybe save that output as a .csv and post here so others (me) can try to load it into Grafana and play around with it.

Also share your Pie chart query if you are happy with the results.

Hey there,

sure, after some Digging I was able to get the CSV output :smiley:

#group,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true,true
#datatype,string,long,dateTime:RFC3339,double,string,string,string,string,string,string,string,string,string,string,string,dateTime:RFC3339,dateTime:RFC3339
#default,count,,,,,,,,,,,,,,,,
,result,table,_time,,IP,IP_24,QC,QH,QT,TLD,Upstream,_field,_measurement,host,path,_start,_stop
,,0,2024-02-27T10:02:21Z,73507864,172.20.0.4,172.20.0.x,IN,baanane.de,A,baanane.de,https://dns.google:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:23Z,8793423,172.20.0.4,172.20.0.x,IN,lol.de,AAAA,lol.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:26Z,23620582,172.20.0.4,172.20.0.x,IN,lan.party,AAAA,lan.party,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:30Z,12426039,172.20.0.4,172.20.0.x,IN,exxessive.das,A,exxessive.das,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:34Z,9029170,172.20.0.4,172.20.0.x,IN,check24.de,AAAA,check24.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:42Z,8594962,172.20.0.4,172.20.0.x,IN,pizza.de,AAAA,pizza.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:45Z,7675430,172.20.0.4,172.20.0.x,IN,google.com,AAAA,google.com,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:52Z,2767033481,172.20.0.4,172.20.0.x,IN,lustigesachen.de,A,lustigesachen.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:02:57Z,14270267,172.20.0.4,172.20.0.x,IN,lustig.de,AAAA,lustig.de,https://dns.google:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:03:01Z,65711,172.20.0.4,172.20.0.x,IN,lustigesachen.de,A,lustigesachen.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:03:06Z,13107974,172.20.0.4,172.20.0.x,IN,3fu.de,AAAA,3fu.de,https://dns.google:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:03:13Z,12115,172.20.0.4,172.20.0.x,IN,lustig.de,AAAA,lustig.de,https://dns.google:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:03:16Z,32417,172.20.0.4,172.20.0.x,IN,lustigesachen.de,A,lustigesachen.de,https://dns.cloudflare.com:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z
,,0,2024-02-27T10:03:20Z,26668141,172.20.0.4,172.20.0.x,IN,error.de,A,error.de,https://dns.google:443/dns-query,Elapsed,tail,w2tj-dns1,/opt/AdGuardHome/data/querylog.json,2024-02-27T08:29:04.294100928Z,2024-02-27T11:29:04.294100928Z

So my guess is that I make something wrong from the beginning and I’m not able to understand how to pull this. The Timeseries should show me first the Queries grouped by IP_24 and a second with all of them.

The query for my PieChart is:

from(bucket: "adguard")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["path"] == "/opt/AdGuardHome/data/querylog.json")
  |> drop(columns: ["_start", "_stop"])
  |> group(columns: ["IP"])
  |> count()
  |> rename(columns: {_value: ""})
  |> yield(name: "count")

Like I Said people, I expected that I was stupid…

What I didn’t unterstood was, that in aggregateWindow() your able to change the function. So I was calling median and not count. With my new Query:

from(bucket: "adguard")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["path"] == "/opt/AdGuardHome/data/querylog.json")
  |> group(columns: ["IP_24"])
  |> aggregateWindow(every: 10s, fn: count, createEmpty: false)

The Values are there as expected. Thanks anyone for the help!

1 Like