Replace peach-monitor with vnStat / vnstatd #24
Labels
No Label
bug
documentation
duplicate
enhancement
help wanted
invalid
maintenance
peach-lib
peach-network
peach-oled
peach-stats
peach-web
question
refactor
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: PeachCloud/peach-workspace#24
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original issue text
peach-monitor
currently uses nest to store data usage limits and totals as JSON in the filesystem. Since we're currently aiming to have a singleyaml
configuration file for PeachCloud, it makes sense for the data associated withpeach-monitor
to live in that file.Edited text
I have a better idea: forget about
peach-monitor
and usevnStat
/vnstatd
instead.https://humdi.net/vnstat/
https://humdi.net/vnstat/man/vnstatd.html
Advantages of this approach:
Refactor peach-monitor to use yaml instead of nestto Replace peach-monitor with vnStatReplace peach-monitor with vnStatto Replace peach-monitor with vnstatdReplace peach-monitor with vnstatdto Replace peach-monitor with vnStat / vnstatdThe
vnstat
database can be outputted as JSON. Here's an example from my local instance:We can write some Rust code to invoke the command and deserialize the output to a
struct
(orVec<>
ofstruct
to represent an array of interfaces). This can then be used to create a Tera context object for displaying usage data inpeach-web
.I think it makes sense to bundle this functionality into the
peach-network
library.The parser is complete: vnstat-parse.
Now we just need to refactor
peach-web
to use the parser for building the network traffic context object.As a bonus, we'll be able to offer higher-granularity statistics compared with the previous implementation :) (ie. day, month, all-time traffic totals).