Closed Hulxv closed 2 years ago
The data retention is configurable and isn't unlimited by default except for year. See the current settings from https://github.com/vergoh/vnstat/blob/master/cfg/vnstat.conf#L90 for these keywords:
Can I edit the configuration directly by terminal ?
Yes, replacing the values with sed
is for example one option. Note that the daemon (vnstatd
) needs to be restarted or sent the HUP
signal in order to load any configuration file changes, assuming it was running when the configuration was updated.
Looking at your implementation, you appear to be reading the database directly. There's nothing wrong doing it like that but I'd suggest you'd add a test for the 'dbversion' entry in the 'info' table. It will get updated if the schema changes. For example #128 is something that will require some changes to be made.
So what does 'dbversion' stand for, and how can I use it to solve this problem?
'dbversion' is the database schema version being stored in the database. Currently it's 1
for all versions using the sqlite database. However, if I need to change the structure then I'll update that number. vnStat will internally know how to handle the change but your implementation isn't. As a result, if you check the version and notice it's something else than 1
then you can gracefully handle the situation instead of having some more random errors getting shown to the users. Once you then have the implementation for something else than version 1
ready then you can select the right implementation for reading the database depending on which database schema version is found.
That's not going to solve any possible problems you are having right now but it will avoid having possible problems in the future.
So if 'dbversion' changed that means database schema changed also and maybe that will be some errors and I would handle it or what I should do in this case?
It's likely to be better to show some error message with "check for update" or something similar if 'dbversion' in the database doesn't match any version you have an implementation included in the used release.
Okay, I would do that. Thanks for the advice.
Hey, I'm Building a client for vnStat ( you can see it at https://github.com/Hulxv/vnstat-client )
But I have a little problem, It is the database is limited and some rows get deleted automatic and that will be a problem for the user. So, Can I fix this problem or that built-in vnStat?
thanks for your time 😃.