Skip to content
Get and push data from Mikrotik Accounting to influxdb.
PHP Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo update image + add simple check. Jun 25, 2019
src Fix a bug with bytes. Jul 15, 2019
.gitignore better docker Jun 25, 2019
Dockerfile Fix docker Jun 23, 2019
LICENSE Create LICENSE Mar 20, 2018 Add some missing functionality. Jul 15, 2019
composer.lock Fix no influxdb port. Jun 27, 2019
mikro-watch v1.0.0 Mar 20, 2018
mikrowatch.service Add service file for systemd integration. May 13, 2018


PHP process to capture and relay or display the mikrotik Accounting data.

Mikro-Watch will :

  • Fetch the data from the mikrotik router.
  • Process each bidirectional transfer to get metrics for each internal IP (within specified range)
  • Push or display data.

Currently push to inflxudb directly, but plans are to output data for telegraf ingestion or display in a simple webpage.

Grafana Example


  • PHP 5.6 or later

  • Composer

  • or Docker

Configuration and running

First, make sure your router is configured to accept request to the account page by going to IP -> Accounting -> Web Access


docker run -d --name mikro-watch \
    -e MIKROTIK_IP= \
    -e INFLUXDB_USER=user \
    -e INFLUXDB_PASS=***pass*** \
    -e INFLUXDB_DATABASE=influxdb \

Docker compose

version: '3'
        image: ncareau/mikro-watch
        container_name: mikro-watch
            - MIKROTIK_IP=
            - NETWORK_RANGE=
            - INFLUXDB_HOST=
            - INFLUXDB_USER=user
            - INFLUXDB_PASS=***pass***
            - INFLUXDB_DATABASE=influxdb
        restart : unless-stopped 


Copy the .env file to .env.local and change the information with your current network.

  • php mikro-watch influxdb will push once to influxdb
  • php mikro-watch daemon will start a daemon pushing to influxdb each 10 sec.
    • --timeout 5 or -t 5 to change the timeout between calls in seconds.

Instructions to install this application as a systemd service are located in the mikrowatch.service file.

Environment Variables

Variable Description
MIKROTIK_IP IP of your mikrotik router
MIKROTIK_PROTO Default: https
MIKROTIK_SSL_VERIFY if using https, verify for valid ssl certificate
NETWORK_RANGE Range of your network to filter ips.
INFLUXDB_HOST Influxdb host
INFLUXDB_USER Influxdb username
INFLUXDB_PASS Influxdb password
INFLUXDB_DATABASE Influxdb database

Note & Troucleshooting

When FastTrack is enabled, some packet will not be accounted for. To disable this (This will result in more CPU usage on your router) disable the fasttrack rule in IP -> Firewall -> Filter Rules.

Calling the accounting webpage resets the counter. This means that if multiple processes or users call the mikrotik api, only a subset of the data will be captured.

You can’t perform that action at this time.