mikrotik-exporter

by alekc

Helm chartv2.1.1App 2.1.1GPL-2.0-or-laterVerified publisher

Prometheus exporter for MikroTik RouterOS devices, exposing metrics for DHCP, interfaces, wireless, CAPsMAN, routing, POE, and more via the actively maintained mktxp exporter.

About this chart

mikrotik-exporter

Prometheus exporter for MikroTik RouterOS devices, exposing metrics for DHCP, interfaces, wireless, CAPsMAN, routing, POE, and more via the actively maintained mktxp exporter.

mktxp polls one or more MikroTik RouterOS devices over the RouterOS API and exposes the results as Prometheus metrics: DHCP leases, interface traffic, wireless/CAPsMAN clients, POE, routes, netwatch, and more. This chart runs it as a single Deployment with its config supplied through a ConfigMap.

Quick start

From the classic chart repository:

helm repo add alekc https://charts.alekc.dev
helm repo update
helm install my-mikrotik-exporter alekc/mikrotik-exporter -f my-values.yaml

Or directly from the OCI registry, no helm repo add needed:

helm install my-mikrotik-exporter oci://charts.alekc.dev/mikrotik-exporter --version 1.0.0 -f my-values.yaml

Verifying the signature

curl -sO https://charts.alekc.dev/pubring.gpg
helm pull oci://charts.alekc.dev/mikrotik-exporter --version 1.0.0 --verify --keyring pubring.gpg

A minimal working values.yaml, pointing at a real router:

config:
  targets: |
    [MyRouter]
      enabled = True
      hostname = 192.168.88.1
      port = 8728
      username = prometheus
      password = "<a real password>"
      dhcp_lease = True
      interface = True
      wireless = True

Maintainers

NameEmailUrl
alekc[email protected]

Source Code

Gotchas

  • config.settings and config.targets are raw mktxp .conf file bodies, not structured YAML. They're rendered verbatim into _mktxp.conf and mktxp.conf; the syntax is mktxp's own INI-style format, not this chart's. See https://github.com/akpw/mktxp/blob/main/_autodocs/02-configuration.md for the full option reference per RouterOS feature.
  • The config volume mounts at /etc/mktxp, not a project-relative path. The image sets XDG_CONFIG_HOME=/etc and mktxp appends its own mktxp/ subdirectory; a previous, unmerged version of this chart mounted /home/mktxp/mktxp/ instead, which the exporter never reads from, silently running with zero configured routers.
  • RouterOS credentials go straight into config.targets as plain text. Use additionalManifests to provision a Secret and mount it alongside the ConfigMap if you'd rather not put the password in values.yaml directly (there's no built-in secretKeyRef substitution in mktxp's config format).
  • networkPolicy.enabled allows broad egress to 0.0.0.0/0 by default. mktxp connects to whatever RouterOS devices you list in config.targets, usually outside the cluster's pod network entirely, so there's no small fixed CIDR to narrow this to out of the box. Narrow it with networkPolicy.extraEgress if your environment allows it.
  • serviceMonitor.create and the legacy prometheus.io/scrape Service annotation are both available. Use whichever matches your Prometheus setup; they're independent, not mutually exclusive.

Upgrade notes

1.0.0

This release replaces the exporter entirely: ogi4i/mikrotik-exporter (upstream abandoned since 2023) is gone, replaced by the actively maintained akpw/mktxp. The two use completely different config formats. If you're upgrading from a 0.x release built on the old exporter:

  • Replace config.devices (the old per-device YAML list) with config.targets, an mktxp .conf body, one [section] per router. See Quick start above for the shape.
  • The Service port default changed from 9436 to 49090 (mktxp's own default). Update any hardcoded port references (Ingress, NetworkPolicy, dashboards).
  • If you had a ServiceMonitor enabled, re-check it after upgrading: this release also fixes a bug where its selector matched on the full label set (including the chart version label), which would have silently stopped matching after any future upgrade anyway.

Values

KeyTypeDefaultDescription
additionalManifestsobject{}Additional raw Kubernetes manifests to render alongside the chart's own resources. Supports any valid Kubernetes object; values are templated with tpl, so a manifest can reference .Release.Namespace and friends.
affinityobject{}Affinity rules for pod scheduling.
annotations.deploymentobject{}Deployment's annotations
commonAnnotationsobject{}Annotations merged onto every resource this chart renders, in addition to each resource's own dedicated annotations field.
commonLabelsobject{}Labels merged onto every resource this chart renders. Never reaches selector/matchLabels, safe to change without forcing a Deployment recreate.
config.settingsstring"[MKTXP]\n port = 49090\n socket_timeout = 2\n\n initial_delay_on_failure = 120\n max_delay_on_failure = 900\n delay_inc_div = 5\n\n bandwidth = False # Turns bandwidth metrics collection on / off\n bandwidth_test_interval = 600 # Interval for collecting bandwidth metrics\n\n minimal_collect_interval = 5 # Minimal metric collection interval\n\n verbose_mode = False # Set it on for troubleshooting\n\n fetch_routers_in_parallel = False # Set to True to fetch multiple routers in parallel\n max_worker_threads = 5 # Max worker threads (parallel fetch only)\n max_scrape_duration = 10 # Max duration per router (parallel fetch only)\n total_max_scrape_duration = 30 # Max overall duration (parallel fetch only)\n"mktxp's system-level settings (_mktxp.conf): exporter port, timeouts, bandwidth testing, and worker concurrency. See https://github.com/akpw/mktxp/blob/main/_autodocs/02-configuration.md
config.targetsstring"[Mkt]\n enabled = True # turns metrics collection for this RouterOS device on / off\n hostname = localhost # RouterOS IP address\n port = 8728 # RouterOS API / API-SSL service port\n\n username = username # RouterOS user, needs 'read' and 'api' permissions\n password = password\n\n use_ssl = False # enables connection via API-SSL service\n no_ssl_certificate = False # enables API-SSL connect without router SSL certificate\n ssl_certificate_verify = False # turns SSL certificate verification on / off\n\n installed_packages = True # Installed packages\n dhcp = True # DHCP general metrics\n dhcp_lease = True # DHCP lease metrics\n\n connections = True # IP connections metrics\n connection_stats = False # Open IP connections metrics\n\n pool = True # Pool metrics\n interface = True # Interfaces traffic metrics\n\n firewall = True # IPv4 Firewall rules traffic metrics\n ipv6_firewall = False # IPv6 Firewall rules traffic metrics\n ipv6_neighbor = False # Reachable IPv6 Neighbors\n\n poe = True # POE metrics\n monitor = True # Interface monitor metrics\n netwatch = True # Netwatch metrics\n public_ip = True # Public IP metrics\n route = True # Routes metrics\n wireless = True # WLAN general metrics\n wireless_clients = True # WLAN clients metrics\n capsman = True # CAPsMAN general metrics\n capsman_clients = True # CAPsMAN clients metrics\n\n user = True # Active Users metrics\n queue = True # Queues metrics\n\n use_comments_over_names = True # when available, forces using comments over interface names\n check_for_updates = False # check for available RouterOS updates\n"mktxp's router entries (mktxp.conf): one [section] per RouterOS device, feature toggles per device. CHANGE ME: the sample entry below is a placeholder, not a real device.
extraContainerslist[]Extra sidecar containers appended to the pod spec, templated with tpl so they can reference .Release.Namespace and friends.
fullnameOverridestring""Overrides the full resource name, instead of the default <release>-<chart> pattern.
image.pullPolicystring"IfNotPresent"Image pull policy.
image.repositorystring"ghcr.io/akpw/mktxp"Image repository.
image.tagstring""Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]Image pull secrets, for a private registry mirror.
ingress.annotationsobject{}Annotations to add to the Ingress
ingress.classNamestring""IngressClass name, e.g. "nginx" or "traefik"
ingress.enabledboolfalseRenders an Ingress for the Service.
ingress.hostslist[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]Ingress host and path rules
ingress.tlslist[]TLS configuration for the Ingress
initContainerslist[]Extra init containers appended to the pod spec, templated with tpl.
nameOverridestring""Overrides the chart name used to build resource names.
networkPolicy.annotationsobject{}Annotations to add to the NetworkPolicy
networkPolicy.enabledboolfalseRender a NetworkPolicy restricting ingress to the Service port and egress to DNS plus the RouterOS API port. mktxp talks to whatever routers you configure in config.targets, which vary per deployer, so egress beyond DNS is broad by default, see Gotchas.
networkPolicy.extraEgresslist[]Additional raw egress rules, appended as-is under spec.egress.
networkPolicy.extraIngresslist[]Additional raw ingress rules, appended as-is under spec.ingress.
nodeSelectorobject{}Node selector for pod scheduling.
podAnnotationsobject{}Annotations added to the pod template.
podSecurityContextobject{}Pod-level securityContext.
replicaCountint1Pod replica count. Running more than one is pointless: every replica would poll the same routers and export the same metrics redundantly.
resourcesobject{"requests":{"cpu":"100m","memory":"32Mi"}}Container resource requests/limits.
securityContextobject{}Container-level securityContext. The image itself already runs as a non-root mktxp user (uid 1000), so no override is required by default.
service.annotationsobject{"prometheus.io/scheme":"http","prometheus.io/scrape":"true"}Annotations to add to the Service. Defaults to the legacy prometheus.io/scrape annotations, a fallback for a Prometheus that isn't using the Operator/serviceMonitor.create below.
service.portint49090Service port, forwards to the exporter's /metrics endpoint.
service.typestring"ClusterIP"Kubernetes Service type.
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
serviceMonitor.annotationsobject{}Annotations to add to the ServiceMonitor
serviceMonitor.createboolfalseRender a ServiceMonitor for the Prometheus Operator.
serviceMonitor.namespacestring""Namespace the ServiceMonitor is created in. Defaults to the release namespace; override if your Prometheus Operator only watches a fixed namespace (e.g. "monitoring").
tolerationslist[]Tolerations for pod scheduling.

Deploy mikrotik-exporter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mikrotik-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmikrotik-exporter is pinned at v2.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply