Mikrocount is a suite of tools that aid in visualising external network activity that goes through a Mikrotik router. It consists of:
mikrocount
: The application hosted in this repo, which periodically fetches accounting data from the Mikrotik router and feeds it to Influxdb.influxdb
: Time-series data store. Mikrocount stores data in a database namedmikrocount
, in a single measurement namedusage
, with a field ofbytes
and tags ofdirection
(Upload or Download) andip
.grafana
: Awesome tool for visualising the data stored in Influxdb.
Your Mikrotik router will need to be configured properly in order to expose accounting data to the local network. Run the following commands in your router's terminal:
/ip accounting
set enabled=yes threshold=2000
/ip accounting web-access
set accessible-via-web=yes
Note:
- If your network is very busy, you should set the threshold to a higher value. Mikrocount queries the Mikrotik router for data every 15 seconds.
- It is strongly recommended that access to your router from the internet over HTTP/HTTPS be blocked by the firewall.
- The accounting feature of Mikrotik doesn't appear to work properly at all for packets that are fasttracked. If you want accurate results from this tool, I recommend you disable the fasttrack feature.
Requirements:
- A computer capable of running Docker, with Docker and docker-compose already installed.
- The computer should preferably be running 24/7.
-
On the computer on which you want Mikrocount to run, create a file named
docker-compose.yml
, in a directory namedmikrocount
. -
Copy the contents of the file
docker-compose-example.yml
in this repository, and paste them into the newly createddocker-compose.yml
file. -
Change the value after
-mikrotikaddr
in the file to the LAN IP address of your Mikrotik router. -
In a terminal session, in the
mikrocount
directory that was created run:$ docker-compose up -d --build ...
(note: some setups may require you to run the aforementioned command using
sudo
). -
After all images have been downloaded and containers are running, wait a minute or so before proceeding.
-
Open
http://<ip of machine running mikrocount>:3000
in a browser. You should be presented with a Grafana login page. -
Login using username/password
admin/admin
. The "Mikrocount Dash" dashboard should be immediately available.
- To stop everything:
docker-compose stop
- To start everything:
docker-compose start
- To delete everything except persisted data:
docker-compose down
- To start everything again:
docker-compose up -d --build
- To delete persisted data:
docker-compose down --volumes
In order to contribute to the development of this project, or to fork and make your own changes, you'll need the following:
To install the required dependencies, run dep ensure
, or make deps
while in the mikrocount
subdirectory.
Using docker-compose-dev.yml
as a reference is recommended for creating a docker-compose config for your development environment.
This software is distributed under the MIT License. See the LICENSE file for more details.
Donations are very welcome, and can be made to the following addresses:
- BTC: 1AWHJcUBha35FnuuWat9urRW2FNc4ftztv
- ETH: 0xAF1Aac4c40446F4C46e55614F14d9b32d712ECBc