mikrotik-exporter
by alekc
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
| Name | Url | |
|---|---|---|
| alekc | [email protected] |
Source Code
Gotchas
config.settingsandconfig.targetsare raw mktxp.conffile bodies, not structured YAML. They're rendered verbatim into_mktxp.confandmktxp.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 setsXDG_CONFIG_HOME=/etcand mktxp appends its ownmktxp/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.targetsas plain text. UseadditionalManifeststo provision aSecretand mount it alongside the ConfigMap if you'd rather not put the password invalues.yamldirectly (there's no built-in secretKeyRef substitution in mktxp's config format). networkPolicy.enabledallows broad egress to0.0.0.0/0by default. mktxp connects to whatever RouterOS devices you list inconfig.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 withnetworkPolicy.extraEgressif your environment allows it.serviceMonitor.createand the legacyprometheus.io/scrapeService 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) withconfig.targets, an mktxp.confbody, one[section]per router. See Quick start above for the shape. - The Service port default changed from
9436to49090(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
| Key | Type | Default | Description |
|---|---|---|---|
| additionalManifests | object | {} | 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. |
| affinity | object | {} | Affinity rules for pod scheduling. |
| annotations.deployment | object | {} | Deployment's annotations |
| commonAnnotations | object | {} | Annotations merged onto every resource this chart renders, in addition to each resource's own dedicated annotations field. |
| commonLabels | object | {} | Labels merged onto every resource this chart renders. Never reaches selector/matchLabels, safe to change without forcing a Deployment recreate. |
| config.settings | string | "[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.targets | string | "[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. |
| extraContainers | list | [] | Extra sidecar containers appended to the pod spec, templated with tpl so they can reference .Release.Namespace and friends. |
| fullnameOverride | string | "" | Overrides the full resource name, instead of the default <release>-<chart> pattern. |
| image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| image.repository | string | "ghcr.io/akpw/mktxp" | Image repository. |
| image.tag | string | "" | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | [] | Image pull secrets, for a private registry mirror. |
| ingress.annotations | object | {} | Annotations to add to the Ingress |
| ingress.className | string | "" | IngressClass name, e.g. "nginx" or "traefik" |
| ingress.enabled | bool | false | Renders an Ingress for the Service. |
| ingress.hosts | list | [{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}] | Ingress host and path rules |
| ingress.tls | list | [] | TLS configuration for the Ingress |
| initContainers | list | [] | Extra init containers appended to the pod spec, templated with tpl. |
| nameOverride | string | "" | Overrides the chart name used to build resource names. |
| networkPolicy.annotations | object | {} | Annotations to add to the NetworkPolicy |
| networkPolicy.enabled | bool | false | Render 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.extraEgress | list | [] | Additional raw egress rules, appended as-is under spec.egress. |
| networkPolicy.extraIngress | list | [] | Additional raw ingress rules, appended as-is under spec.ingress. |
| nodeSelector | object | {} | Node selector for pod scheduling. |
| podAnnotations | object | {} | Annotations added to the pod template. |
| podSecurityContext | object | {} | Pod-level securityContext. |
| replicaCount | int | 1 | Pod replica count. Running more than one is pointless: every replica would poll the same routers and export the same metrics redundantly. |
| resources | object | {"requests":{"cpu":"100m","memory":"32Mi"}} | Container resource requests/limits. |
| securityContext | object | {} | Container-level securityContext. The image itself already runs as a non-root mktxp user (uid 1000), so no override is required by default. |
| service.annotations | object | {"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.port | int | 49090 | Service port, forwards to the exporter's /metrics endpoint. |
| service.type | string | "ClusterIP" | Kubernetes Service type. |
| serviceAccount.annotations | object | {} | Annotations to add to the service account |
| serviceAccount.create | bool | true | Specifies whether a service account should be created |
| serviceAccount.name | string | "" | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| serviceMonitor.annotations | object | {} | Annotations to add to the ServiceMonitor |
| serviceMonitor.create | bool | false | Render a ServiceMonitor for the Prometheus Operator. |
| serviceMonitor.namespace | string | "" | Namespace the ServiceMonitor is created in. Defaults to the release namespace; override if your Prometheus Operator only watches a fixed namespace (e.g. "monitoring"). |
| tolerations | list | [] | 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmikrotik-exporter is pinned at v2.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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