Merge pull request #13 from M0r13n/repeating-interface-graphs

Repeating interface graphs
This commit is contained in:
Leon Morten Richter 2022-11-27 15:42:43 +01:00 committed by GitHub
commit 35a17b38eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 313 additions and 87 deletions

View file

@ -165,3 +165,21 @@ I find them very hard to read.
In addition, the API offers a lot of flexibility.
Any command can be executed on RouterOS via the API.
Thus it is possible to collect complex metrics.
### I get a PermissionError when running docker-compose up
When bind-mounting a directory from the host into a container, files and directories
maintain the permissions they **have on the host**. These can not be changed by Docker.
Typically, a bind-mounted directory has permissions like these: `rwxrwxr-x`.
This means that the container can read from the bind-mounted directory. But it can not
write or modify the mounted files.
This mostly works fine. But the Prometheus exporter mktxp has a specialty:
It may update it's configuration if some keys are missing from the configuration file.
Imagine, that the key `ipv6_firewall` is missing from the **mktxp.conf**. In this case
mktxp will add `ipv6_firewall=false` to the configuration file instead of failing.
This is a helpful feature, but can cause the container to crash, if the user inside
the container lacks write permissions.
In order to resolve this issue, make sure that all keys that mktxp currently supports
are listed in your **mktxp.conf** file.

View file

@ -48,7 +48,7 @@ services:
mktxp:
# https://github.com/M0r13n/mikrotik_monitoring
# Note: You might need to build the image yourself if not on AMD64 or ARM-v7/V8
image: leonmorten/mktxp:latest
image: mktxp:latest
volumes:
# Since Version v0.37 mktxp runs as single user
# Prior it was root
@ -66,7 +66,7 @@ services:
- ./nginx/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt
- ./nginx/self-signed.conf:/etc/nginx/ssl/self-signed.conf
ports:
- 80:80
- 80:80 # You may adjust to some unprivileged ports
- 443:443
networks:
- default

View file

@ -312,7 +312,9 @@
"type": "bargauge"
},
{
"aliasColors": {},
"aliasColors": {
"ARM": "green"
},
"bars": false,
"dashLength": 10,
"dashes": false,
@ -693,6 +695,7 @@
"datasource": {
"type": "prometheus"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
@ -728,7 +731,7 @@
"x": 2,
"y": 3
},
"id": 8,
"id": 6,
"links": [],
"maxDataPoints": 100,
"options": {
@ -749,37 +752,17 @@
"pluginVersion": "9.0.6",
"targets": [
{
"application": {
"filter": "General"
},
"datasource": {
"type": "prometheus"
},
"expr": "mktxp_system_uptime{routerboard_address=\"$node\"}",
"format": "time_series",
"functions": [],
"group": {
"filter": "Network"
},
"hide": false,
"host": {
"filter": "MikroTik Router"
},
"instant": true,
"interval": "",
"intervalFactor": 1,
"item": {
"filter": "System version and hw"
},
"legendFormat": "{{version}} ",
"mode": 2,
"options": {
"showDisabledItems": false
},
"refId": "A"
"legendFormat": "{{board_name}}",
"refId": "B"
}
],
"title": "System version",
"title": "Routerboard HW",
"type": "stat"
},
{
@ -860,7 +843,6 @@
"datasource": {
"type": "prometheus"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
@ -896,7 +878,7 @@
"x": 2,
"y": 5
},
"id": 6,
"id": 8,
"links": [],
"maxDataPoints": 100,
"options": {
@ -917,17 +899,37 @@
"pluginVersion": "9.0.6",
"targets": [
{
"application": {
"filter": "General"
},
"datasource": {
"type": "prometheus"
},
"expr": "mktxp_system_uptime{routerboard_address=\"$node\"}",
"format": "time_series",
"functions": [],
"group": {
"filter": "Network"
},
"hide": false,
"host": {
"filter": "MikroTik Router"
},
"instant": true,
"interval": "",
"legendFormat": "{{board_name}}",
"refId": "B"
"intervalFactor": 1,
"item": {
"filter": "System version and hw"
},
"legendFormat": "{{version}} ",
"mode": 2,
"options": {
"showDisabledItems": false
},
"refId": "A"
}
],
"title": "Routerboard HW",
"title": "System version",
"type": "stat"
},
{
@ -2985,7 +2987,7 @@
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 30,
"gradientMode": "none",
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
@ -3025,7 +3027,23 @@
},
"unit": "Bps"
},
"overrides": []
"overrides": [
{
"matcher": {
"id": "byName",
"options": "| prerouting | passthrough | special dummy rule to show fasttrack counters"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-green",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 6,
@ -3087,7 +3105,10 @@
"type": "timeseries"
},
{
"aliasColors": {},
"aliasColors": {
"download": "dark-green",
"upload": "dark-blue"
},
"bars": false,
"dashLength": 10,
"dashes": false,
@ -3186,7 +3207,9 @@
}
},
{
"aliasColors": {},
"aliasColors": {
"latency": "dark-green"
},
"bars": false,
"dashLength": 10,
"dashes": false,
@ -4587,8 +4610,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@ -4722,8 +4744,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@ -4884,8 +4905,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "#EAB839",
@ -4989,8 +5009,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@ -5090,8 +5109,7 @@
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
"color": "red"
},
{
"color": "orange",
@ -5459,6 +5477,157 @@
"align": false
}
},
{
"collapsed": true,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 142
},
"id": 125,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "dark-purple",
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 30,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"noValue": "-",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bps"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "tx"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "rx"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-blue",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 6,
"x": 0,
"y": 143
},
"id": 108,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"repeat": "interface_name",
"repeatDirection": "h",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "(rate(mktxp_interface_rx_byte_total{routerboard_address=\"$node\", name=\"$interface_name\"}[$__rate_interval]) * 8)",
"legendFormat": "rx",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "(rate(mktxp_interface_tx_byte_total{routerboard_address=\"$node\", name=\"$interface_name\"}[$__rate_interval]) * 8)",
"hide": false,
"legendFormat": "tx",
"range": true,
"refId": "D"
}
],
"title": "$interface_name",
"type": "timeseries"
}
],
"title": "Interface Details",
"type": "row"
},
{
"collapsed": false,
"datasource": {
@ -5468,7 +5637,7 @@
"h": 1,
"w": 24,
"x": 0,
"y": 142
"y": 143
},
"id": 80,
"panels": [],
@ -5499,8 +5668,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@ -5515,7 +5683,7 @@
"h": 3,
"w": 6,
"x": 0,
"y": 143
"y": 144
},
"id": 102,
"options": {
@ -5574,7 +5742,7 @@
"h": 8,
"w": 18,
"x": 6,
"y": 143
"y": 144
},
"hiddenSeries": false,
"id": 77,
@ -5708,8 +5876,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "yellow",
@ -5733,7 +5900,7 @@
"h": 13,
"w": 6,
"x": 0,
"y": 146
"y": 147
},
"id": 78,
"links": [],
@ -5832,8 +5999,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
},
@ -5845,7 +6011,7 @@
"h": 8,
"w": 9,
"x": 6,
"y": 151
"y": 152
},
"id": 98,
"options": {
@ -5931,8 +6097,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "yellow",
@ -5956,7 +6121,7 @@
"h": 8,
"w": 9,
"x": 15,
"y": 151
"y": 152
},
"id": 100,
"options": {
@ -6026,17 +6191,47 @@
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"definition": "mktxp_interface_rx_byte_total{routerboard_address=\"$node\"}",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "interface_name",
"options": [],
"query": {
"query": "mktxp_interface_rx_byte_total{routerboard_address=\"$node\"}",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "/.*,name=\"([^\"]*).*/",
"skipUrlSync": false,
"sort": 1,
"type": "query"
}
]
},
"time": {
"from": "now-5m",
"from": "now-15m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Mikrotik MKTXP Exporter",
"uid": "0j4sdLm7z",
"version": 10,
"version": 14,
"weekStart": ""
}

View file

@ -21,3 +21,5 @@
bandwidth = True # Turns metrics bandwidth metrics collection on / off
bandwidth_test_interval = 420 # Interval for colllecting bandwidth metrics
verbose_mode = False # Set it on for troubleshooting

View file

@ -11,26 +11,37 @@
## 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 = Mascha33 # Change to your Mikrotik password
port = 8728 # Default Port for Mikrotik API
[Sample-Router]
enabled = False # turns metrics collection for this RouterOS device on / off
hostname = localhost # RouterOS IP address
port = 8728 # RouterOS IP Port
username = username # RouterOS user, needs to have 'read' and 'api' permissions
password = password
use_ssl = False # enables connection via API-SSL servis
no_ssl_certificate = False # enables API_SSL connect without router SSL certificate
ssl_certificate_verify = False # turns SSL certificate verification on / off
installed_packages = True # Installed packages
dhcp = True # DHCP general metrics
dhcp_lease = True # DHCP lease metrics
connections = True # IP connections metrics
pool = True # Pool metrics
interface = True # Interfaces traffic metrics
firewall = True # IPv4 Firewall rules traffic metrics
ipv6_firewall = False # IPv6 Firewall rules traffic metrics
ipv6_neighbor = False # Reachable IPv6 Neighbors
monitor = True # Interface monitor metrics
poe = True # POE metrics
public_ip = True # Public IP metrics
route = True # Routes metrics
wireless = True # WLAN general metrics
wireless_clients = True # WLAN clients metrics
capsman = True # CAPsMAN general metrics
capsman_clients = True # CAPsMAN clients metrics
use_comments_over_names = True # when available, forces using comments over the interfaces names