prometheus mikrotik device(s) exporter
Go to file
Reinhard Tartler aa5ef26ed3 wlansta: Record wifi signal strength
signal-strength-ch0 is only accurate for devices with one antenna. Many
mikrotik devices have two, or even three channels, and just looking at ch0 is
not helpful in those cases.

Instead, look at the property 'signal-strength'. Annoyingly, it is does come as
a string with the negotiated bandwidth attached (e.g.,
signal-strength=-66dBm@HT20-7) which needs to be parsed out.
2020-03-30 06:55:15 -04:00
.circleci switch to go modules (#58) 2019-11-16 00:05:31 -05:00
collector wlansta: Record wifi signal strength 2020-03-30 06:55:15 -04:00
config Add health collector (#70) 2020-02-10 13:55:10 -05:00
examples/kubernetes/single-device more dev work (#1) 2017-09-16 22:38:01 -04:00
scripts fixed typo in start.sh permissions assignment (#53) 2019-10-16 12:07:35 -04:00
.gitignore #36 attempt to fix api login auth issue (#38) 2019-07-02 20:46:19 -04:00
Dockerfile use debian instead of alpine 2019-07-21 18:10:43 -04:00
Dockerfile.arm64 various issues fixing (#49) 2019-09-02 14:51:14 -04:00
Dockerfile.armhf Fix docker build to make runnable executable (#39) 2019-07-05 22:17:33 -04:00
go.mod Added support to auto discovery with SRV DNS registry (#60) 2020-02-03 22:03:45 -05:00
go.sum Added support to auto discovery with SRV DNS registry (#60) 2020-02-03 22:03:45 -05:00
LICENSE edit and tickle to build 2019-02-21 22:42:14 -05:00
main.go Add health collector (#70) 2020-02-10 13:55:10 -05:00
MAINTAINERS.md clean up and adding in additional files 2017-10-12 08:36:20 -04:00
Makefile switch to go modules (#58) 2019-11-16 00:05:31 -05:00
README.md Added support to auto discovery with SRV DNS registry (#60) 2020-02-03 22:03:45 -05:00
VERSION switch to go modules (#58) 2019-11-16 00:05:31 -05:00

Docker Pulls

prometheus-mikrotik

tl;dr - prometheus exporter for mikrotik devices

This is still a work in progress .. consider master at the moment as a preview release.

Description

A Prometheus Exporter for Mikrotik devices. Can be configured to collect metrics from a single device or multiple devices. Single device monitoring can be configured all on the command line. Multiple devices require a configuration file. A user will be required that has read-only access to the device configuration via the API.

Currently the exporter collects metrics for interfaces and system resources. Others can be added as long as published via the API.

Mikrotik Config

Create a user on the device that has API and read-only access.

/user group add name=prometheus policy=api,read,winbox

Create the user to access the API via.

/user add name=prometheus group=prometheus password=changeme

Single Device

./mikrotik-exporter -address 10.10.0.1 -device my_router -password changeme -user prometheus

where address is the address of your router. device is the label name for the device in the metrics output to prometheus. The user and password are the ones you created for the exporter to use to access the API.

Config File

./mikrotik-exporter -config-file config.yml

where config-file is the path to a config file in YAML format.

example config
devices:
  - name: my_router
    address: 10.10.0.1
    user: prometheus
    password: changeme
  - name: my_second_router
    address: 10.10.0.2
    port: 8999
    user: prometheus2
    password: password_to_second_router
  - name: routers_srv_dns
    srv:
      record: _mikrotik._udp.example.com
    user: prometheus
    password: password_to_all_dns_routers
  - name: routers_srv_custom_dns
    srv:
      record: _mikrotik2._udp.example.com
      dns:
        address: 1.1.1.1
        port: 53
    user: prometheus
    password: password_to_all_dns_routers

features:
  bgp: true
  dhcp: true
  dhcpv6: true
  dhcpl: true
  routes: true
  pools: true
  optics: true

If you add a devices with the srv parameter instead of address the exporter will perform a DNS query to obtain the SRV record and discover the devices dynamically. Also, you can specify a DNS server to use on the query.

example output
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether2",name="my_router"} 1.4189902583e+10
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether3",name="my_router"} 2.263768666e+09
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether4",name="my_router"} 1.6572299e+08
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether5",name="my_router"} 1.66711315e+08
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether6",name="my_router"} 1.0026481337e+10
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether7",name="my_router"} 3.18354425e+08
mikrotik_interface_tx_byte{address="10.10.0.1",interface="ether8",name="my_router"} 1.86405031e+08