Table with snmp traffic per day, is it possible?

Please bear with me, I am getting my feet wet with Grafana/Telegraf/InfluxDB.

I succeeded following tutorials to poll a router via snmp and have its traffic graphed. Nice!

Now, I need a table containing traffic per time frame, especially daily. Something like this:

|        Day        | ifHCInOctets  | ifHCOutOctets | Total    |
|-------------------|---------------|---------------|----------|
| February 21, 2017 |         xy GB |         xy GB |    xy GB |
| February 20, 2017 |         xy GB |         xy GB |    xy GB |
| February 19, 2017 |         xy GB |         xy GB |    xy GB |

I have seen the advice in How can I aggregate metrics per day in a Grafana table?, but the web editor can’t be fed with it(?).

Thank you for reading.

Yes, you can.

Write data to database with tag keys, example if the value of the ch is your key:

curl -i -XPOST 'http://localhost:8086/write?db=snmp' --data-binary "daily,ch=ifHCInOctets value=1024"
curl -i -XPOST 'http://localhost:8086/write?db=snmp' --data-binary "daily,ch=ifHCOutOctets value=100"
curl -i -XPOST 'http://localhost:8086/write?db=snmp' --data-binary "daily,ch=Total value=1124"

After create a Table and add tag(ch) to the GROUP BY section, and $tag_ch variable name to the ALIAS BY section.

You can group by time 24h, give a local time zone and choose starting and ending dates at midnight by clicking on last 7 days or any other similar choice.

SELECT SUM("ifHCInOctets") AS "ifHCInOctets", SUM("ifHCOutOctets") AS "ifHCOutOctets", SUM("Total") AS "Total" FROM "measurement" WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')

If Total is not a field and it’s a calculation by adding the first two column, just do :

SELECT SUM("ifHCInOctets") AS "ifHCInOctets", SUM("ifHCOutOctets") AS "ifHCOutOctets", SUM("ifHCInOctets") + SUM("ifHCOutOctets") AS "Total" FROM "measurement" WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')

EDIT :
Since ifHCInOctets and ifHCOutOctets are counters, the suggested code is wrong but it would work for other types of data.

EDIT 2 :
I haven’t tested the code but I think you could do something like this for the first two columns :

SELECT SUM("nnd_ifHCInOctets") AS "ifHCInOctets", SUM("nnd_ifHCOutOctets") AS "ifHCOutOctets" FROM (SELECT non_negative_difference(max("ifHCInOctets")) AS "nnd_ifHCInOctets", non_negative_difference(max("ifHCOutOctets")) AS "nnd_ifHCOutOctets" FROM "measurement" WHERE $timefilter) WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')

First you calculate the difference to get the number of octets since the previous timestamp then you sum by 24h.