Page 1 of 1

Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Sun Feb 07, 2021 11:15 pm
by staque
Hi all, is there a way to get bandwidth monitoring data to save to an attached USB drive rather than the on-board flash memory? I would also like to get data saved more frequently in combination with writing to the USB drive. My understanding is data are only saved every four hours, with that frequency intended to preserve the life of the flash - however, I assume writing to a USB would make the external memory the disposable object which is easier to replace.

Re: Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Sun Feb 07, 2021 11:47 pm
by Lantis
It's not really configurable, but you could customise it yourself.
Is that something you're comfortable with and would like guidance on?

Re: Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Sun Feb 07, 2021 11:58 pm
by staque
My gut reaction is to say yes. It's hard to gauge without knowing how extensive the customization work would be, but I'm generally adventurous. Let's go for it!

Re: Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Mon Feb 08, 2021 6:24 am
by Lantis
Alright, by no means a comprehensive guide.

/etc/init.d/bwmon-gargoyle
https://github.com/ericpaulbishop/gargo ... it#L20-L32
Those lines control where the backups will be read from for restoring into memory

https://github.com/ericpaulbishop/gargo ... it#L36-L38
Those lines control where the backups will be output to.

https://github.com/ericpaulbishop/gargo ... .init#L283
Controls how often the backup fires

You also need to make sure that the usb stick is available at boot before bwmon starts. As it currently stands it would attempt to start first. You might want to change its start order to 99 (last) and disable then enable the startup script so it relinks to the right spot.
https://github.com/ericpaulbishop/gargo ... nd.init#L2

If you wanted to backup quotas as well, that's a little more in-depth.

Re: Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Sat Feb 04, 2023 4:07 am
by pkkrusty
Did you make any progress on this? I ask because I had issues with my main router a few months ago and ended up having to replace it. The symptoms made me suspicious that I may have thrashed a portion of the flash, with approx 150 users and 2 years of use. @Lantis Do you know how much/if any wear leveling happens with OpenWRT/Gargoyle? I may be totally off base and just need to re-flash the firmware, but worth getting an expert opinion.

Re: Saving bandwidth monitoring data to USB, higher frequency saving

Posted: Sat Feb 04, 2023 6:24 am
by Lantis
There's no wear levelling in OpenWrt/Gargoyle itself. The flash controllers may do some on board, and may do detection of bad blocks.
This is also dependent on flash chip, and file system type.
The backups are triggered every 4 hours, which for 2 years is ~4.5k writes. It should not have caused significant issues.