Automated Usage Script without usermanager
Summary
I wrote a usage tracking script based on the original Automated Billing Script The way I run it is using a Mikrotik box setup to pass everything through transparently then I generated a Queue per IP address to keep track of the usage. On my test box (A PowerRouter 732) I currently have 3 class C blocks passing through with only 3% cpu (Multi CPU enabled).
==Todo==: I plan on giving this script the ability to backup to a file on the mikrotik so it will count both data in the queue currently + data usage saved in the file (in case you lose power to the device or have to restart it at any time)
I also plan on modifying the monthend script further so that it can only be triggered on the last hour of the last day of the month. This means you could then run the usage script hourly to get more frequent updates.
See below the script for details on how it works.
The Scripts
Overseer
Like the automated billing, this also has a calling script "Overseer"
:global found
/system script run monthend
:if ([$found] = "true") do={ /system script run monthlyreport; :log info "--Completed Monthly Report--"}
:if ([$found] = "false") do={ /system script run usagewarning; :log info "--Completed Usage Report--"}