Bandwidth usage report per IP address

I created a simple python script for collecting data from mikrotik accounting (documetation) feature.

Here is my “mik_collector.py” script:

all you need to change is router_ip variable to match your router IP

after that you can run this script simply with this command:

python mik_collector.py

this will collect data from mikrotik every 5 seconds and store it in data.db sqlite3 database in the same directory as the script is.

All you need to do at mikrotik side is to enable accounting feature:

If you want to analyze your collected data you can do it with sqlite3 command from Ubuntu command prompt:

sqlite3 data.db "select * from sum_per_month order by month"

like this:

you can write your own queries, all data is stored in a table named accounting. You can share your query in the comments :)

(2) Comments

  • Gerry
    01 May 2020

    Hello, Thank you so much for this great tool. Is their any way to use with fast-track enabled ? (Best of both..) Thanks,

  • IS
    20 May 2020

    Thanks for the tool :)

Leave a Comment