Switch to mktxp

This commit is contained in:
Leon Morten Richter 2021-07-15 17:47:54 +02:00
parent 88f6580500
commit 0b8c8b4662
No known key found for this signature in database
GPG key ID: 268100ABB6E5776A
7 changed files with 4581 additions and 1299 deletions

View file

@ -4,10 +4,8 @@ Over the past years I replaced all my networking gear with Mikrotik devices. I a
- [A blog post by Devin Smith that first got me interested](https://blog.devinsmith.co.za/home-internet-grafana-lockdown/)
- [A somewhat useable Grafana Dashboard](https://grafana.com/grafana/dashboards/10950)
- [A Prometheus exporter for Mikrotik devices](https://github.com/nshttpd/mikrotik-exporter)
NOTE: I recently stumbled across [mktxp](https://github.com/akpw/mktxp). This is an alternative for `mikrotik-exporter` and seems to be more actively maintained. I am currently thinking about switching to this exporter.
- [A Prometheus exporter for Mikrotik devices written in Python](https://github.com/akpw/mktxp).
- [A Prometheus exporter for Mikrotik devices written in Go](https://github.com/nshttpd/mikrotik-exporter)
## Setup
- Router running RouterOS 7.x.x
@ -51,12 +49,26 @@ sudo pip3 install docker-compose
sudo systemctl enable docker
```
Spin up Grafana and Prometheus:
Build the mktxp Docker image
```bash
# Get the mktxp repository
git clone https://github.com/akpw/mktxp.git
# Go into the newly downloaded repo
cd mktxp
# Build the docker image
docker build -t mktxp
```
Now get this repo and install all services:
```bash
# Clone this repo
git clone https://github.com/M0r13n/mikrotik_monitoring.git
# Go into the cloned directory
cd mikrotik_monitoring
@ -64,4 +76,9 @@ cd mikrotik_monitoring
sudo docker-compose up -d
```
You may need to adjust the following configuration files and add your own credentials for your router:
- `mktxp/mktxp.conf`
Done. You should now be able to open the Grafana dashboard on Port 3000 of your Raspberry Pi.

View file

@ -6,19 +6,6 @@ volumes:
services:
# Mikrotik Exporter
# https://github.com/nshttpd/mikrotik-exporter
mikrotik_exporter:
image: nshttpd/mikrotik-exporter-linux-arm64:1.0.12-DEVEL # Change this depending on your version and/or if you built the image locally
volumes:
- './mikrotik_exporter:/config'
env_file: .env
ports:
- 9436:9436
networks:
- default
restart: unless-stopped
# Prometheus
# https://github.com/stefanprodan/dockprom
prometheus:
@ -59,3 +46,15 @@ services:
- default
labels:
org.label-schema.group: "monitoring"
# MKTXP
# https://github.com/akpw/mktxp
mktxp:
image: mktxp:latest
volumes:
- './mktxp/:/root/mktxp/'
ports:
- 49090:49090
networks:
- default
restart: unless-stopped

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
devices:
- name: Chateau
address: 192.168.0.1
user: prometheus
password: FOOO
features:
bgp: false
dhcp: true
dhcpv6: true
dhcpl: true
routes: true
firmware: true
pools: true
monitor: true
health: true
resource: true
interface: true
health: true
pool: true
wlansta: true
wlanif: true
lte: false
netwatch: true

23
mktxp/_mktxp.conf Normal file
View file

@ -0,0 +1,23 @@
## Copyright (c) 2020 Arseniy Kuznetsov
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
[MKTXP]
port = 49090
socket_timeout = 2
initial_delay_on_failure = 120
max_delay_on_failure = 900
delay_inc_div = 5
bandwidth = True # Turns metrics bandwidth metrics collection on / off
bandwidth_test_interval = 420 # Interval for colllecting bandwidth metrics

36
mktxp/mktxp.conf Normal file
View file

@ -0,0 +1,36 @@
## Copyright (c) 2020 Arseniy Kuznetsov
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
[Chateau] # Change to your Router
capsman_clients = True
firewall = True
wireless_clients = True
use_ssl = False
pool = True
wireless = True
monitor = True
capsman = True
netwatch = True
ssl_certificate_verify = False
enabled = True
use_comments_over_names = True
no_ssl_certificate = False
dhcp_lease = True
dhcp = True
route = True
interface = True
poe = False # Enable for PoE stats
hostname = 192.168.0.1 # Change to your IP
username = prometheus # Change to your Mikrotik user
password = TOP_SECRET # Change to your Mikrotik password
port = 8728 # Default Port for Mikrotik API

View file

@ -28,4 +28,4 @@ scrape_configs:
# scheme defaults to 'http'.
static_configs:
- targets: ['mikrotik_exporter:9436']
- targets: ['mikrotik_exporter:9436', 'mktxp:49090']