Where are the data of quotas saved?

Report issues relating to bandwith monitoring, bandwidth quotas or QoS in this forum.

Moderator: Moderators

pkkrusty
Posts: 49
Joined: Mon Jan 13, 2020 4:41 pm

Re: Where are the data of quotas saved?

Post by pkkrusty »

Not sure which error log you mean. Here's what happens when I type in the command in my SSH session:

Code: Select all

root@master-router:~# restore_quotas -v
restore_quotas: invalid option -- v
ERRROR: No wan interface specified
root@master-router:~# 
(I tried verbose argument just in case that gave more info. It didn't)

pkkrusty
Posts: 49
Joined: Mon Jan 13, 2020 4:41 pm

Re: Where are the data of quotas saved?

Post by pkkrusty »

I set up the router to send syslog messages to my syslog server as per viewtopic.php?f=7&t=1736 and set the level at 7, but didn't see anything show up after I typed the restore_quotas command.

Lantis
Moderator
Posts: 6920
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Where are the data of quotas saved?

Post by Lantis »

You've not provided any of the command line arguments.

Code: Select all

restore_quotas    -w $wan_if -d $death_mark -m $death_mask -s "$lan_mask" -t $lan_ipmask6 -c "0 0,4,8,12,16,20 * * * /usr/bin/backup_quotas >/dev/null 2>&1"
That being said, there's a lot of moving pieces in how this works and this is probably not the right way to do things.
I'll have a think about a more sensible approach. However for now, the best method is to run backup_quotas, modify the one you want, modify /usr/lib/Gargoyle/restart_firewall.sh and comment out the line which also does this backup, then run the restart firewall command.
This will make sure everything is rebuilt properly.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pkkrusty
Posts: 49
Joined: Mon Jan 13, 2020 4:41 pm

Re: Where are the data of quotas saved?

Post by pkkrusty »

ok, I'll give that a try. I looked at the gargoyle_firewall_util.sh also and I wonder I'm running into a problem if I'm making changes when the crontab is running its backup_quotas.

Looking at the individual quota files from the backups I was doing the other day, it looks like the backup_quotas is/was running successfully, and has everyone's usage correctly listed, but then doing a restore of that is not getting those all those numbers back into the active firewall (just some of them). It's all over my head, but maybe that gives you a little more to go on.

with the restore_quotas command you put there, do I just copy and paste that verbatim into the SSH session, or do I need to adjust any of the arguments?

Lantis
Moderator
Posts: 6920
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Where are the data of quotas saved?

Post by Lantis »

The ability to easily alter a quota will be available in a future version. Reset it to zero, expire it early or set it anywhere in between.
If anyone wants to attempt backporting it to an earlier one, you can find the code here:
https://github.com/lantis1008/gargoyle/ ... a8d3126c4a

For the latest 1.13.x builds, it should just apply and work minimal effort.
For anything before IPv6 support was introduced, there is at least a change required to the "sed" command.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pkkrusty
Posts: 49
Joined: Mon Jan 13, 2020 4:41 pm

Re: Where are the data of quotas saved?

Post by pkkrusty »

Super, that sounds like a useful tool to wait for. Is 1.13 going to be a stable version or remain experimental like 1.11?

I’ve found that if I give the system a few minutes between operations (DHCP assignments, quotas, backup settings) things stay as they should. Not ideal since adding new people to the network and adjusting quotas takes a long time, but for the time being it works. My use case is probably pretty far out there, with over 200 DHCP assignments and individual quotas that need to get processed. CPU and RAM usage remains about 15% and 20% respectively, so I don’t think I’m over-taxing the router.

Lantis
Moderator
Posts: 6920
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Where are the data of quotas saved?

Post by Lantis »

It will be released as experimental and should be done within a week.
To be clear though, I haven’t backported it to 1.13. Once that is released I’ll start putting up new experimental work for 21.02 based OpenWrt

The slightly shortcut formula which should run faster for you (instead of having to backup and recreate every single quota) is
bw_get -i IDOFQUOTA -f /tmp/IDOFQUOTA.quota
edit the last number in the file to be the number of bytes consumed
bw_set -i IDOFQUOTA -f /tmp/IDOFQUOTA.quota

ID of quota can be found in the firewall entries /etc/config/firewall
If the quota had an ID of “192.168.1.10_A”, and it was a Download limit, the full ID is “192.168.1.10_A_ingress”.
Upload = egress
Both = combined
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pkkrusty
Posts: 49
Joined: Mon Jan 13, 2020 4:41 pm

Re: Where are the data of quotas saved?

Post by pkkrusty »

Lantis wrote:
Sat Jan 15, 2022 6:38 pm
To be clear though, I haven’t backported it to 1.13. Once that is released I’ll start putting up new experimental work for 21.02 based OpenWrt
If I'm reading this correctly, 1.13 does not have the quota adjustment improvements?

Lantis
Moderator
Posts: 6920
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Where are the data of quotas saved?

Post by Lantis »

Correct
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Post Reply