How to collect daily and monthly bandwidth consumption

I am on Comcast and they have a monthly 1TB bandwidth cap at which point I have to pay. I’m interested in adding two panels, backed by Prometheus, to my dashboard. The first is bandwidth used today, resetting every day at midnight. The second is bandwidth used this month so far, resetting every month. I’ve struggled to get a query which seems to work. Prometheus is polling SNMP from my router and I’m currently using ifInOctets and ifOutOctets.

Thank you!

I ran into something similar a while back. If you’re using ifInOctets and ifOutOctets, try using increase() and summing both together. Also, if your router supports them, switching to ifHCInOctets/ifHCOutOctets is much more reliable since the normal counters can wrap pretty fast on higher speed connections.

For daily usage, a 1d increase works well, and for monthly I ended up using a rolling 30d panel since Prometheus doesn’t handle calendar month resets very cleanly.