vergoh / vnstat

vnStat - a network traffic monitor for Linux and BSD
GNU General Public License v2.0
1.36k stars 120 forks source link

Get JSON data for current day #167

Closed agneevX closed 3 years ago

agneevX commented 3 years ago

Can I get the data in JSON for the current day only?

Edit: I'm running Raspberry Pi OS - Debian Buster, so I have version 1.18 installed, not the latest. If it is fixed in the current release, please feel free to close this issue.

vergoh commented 3 years ago

The option to limit the output length of --json was added in version 2.0 resulting in vnstat --json d 1 being possible and vnstat --json d --limit 1 as alternative starting from version 2.6.

The latest release can be installed with these instructions if necessary: https://humdi.net/wiki/vnstat/install/in_debian

agneevX commented 3 years ago

Not sure if I should create a fresh issue, but what is the default interval at which the stats update and is there a way to change it?

vergoh commented 3 years ago

That's controlled with the UpdateInterval and SaveInterval settings in the configuration file. UpdateInterval defines how often the daemon will read the data and SaveInterval on the other hand defines how often the cached data is written to disk. From the vnstat command user point of view, SaveInterval is the interval you see the stats update. See the vnstat.conf man page for more details.