I am running OpenWRT with Vnstat2 and the data that Vnstat collects is written to an external USB dirve (/mnt/sda1/vnstat). In this image, I can see the total bytes across the WAN port for the current month.
What I would like to do is to capture the month-to-date total (only the current month) and port it to my MQTT broker probably once a day. Can someone enlighten me as to where the data is stored and how I can access it. I can either build a script on the router or build a python script on the MQTT broker.
You can use /usr/bin/vnstat to output text stats. Use -? or --longhelp to see command line switches. So something like the below for current month stats (first is more readable, second is in a more easily parsed format).