Skip to main content

Ubiquiti EdgeRouter

Monitor Ubiquiti EdgeRouter — interface throughput, CPU/memory, routing table size, and connection stats — using SNMP Exporter.

Pattern: SNMP Exporter → Prometheus scrape → xScaler remote_write


Prerequisites

  • EdgeRouter 2.x+, SNMP v2c enabled
  • snmp_exporter binary
  • xScaler tenant credentials (token + tenant ID)

Enable SNMP on EdgeRouter

configure
set service snmp community public authorization ro
set service snmp community public network 0.0.0.0/0
commit; save

Option A — Prometheus Exporter

./snmp_exporter --config.file=snmp.yml

Prometheus config:

scrape_configs:
- job_name: ubiquiti
static_configs:
- targets: ['192.168.1.1']
metrics_path: /snmp
params:
module: [if_mib]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- target_label: __address__
replacement: localhost:9116

remote_write:
- url: https://euw1-01.m.xscalerlabs.com/api/v1/push
authorization:
credentials: <token>
headers:
X-Scope-OrgID: <tenant-id>

Option B — Grafana Alloy

prometheus.exporter.snmp "edgerouter" {
config_file = "/etc/alloy/snmp.yml"
targets = [{
name = "edgerouter"
target = "192.168.1.1"
module = "if_mib"
}]
}

prometheus.scrape "ubiquiti" {
targets = prometheus.exporter.snmp.edgerouter.targets
forward_to = [prometheus.remote_write.xscaler.receiver]
scrape_interval = "60s"
}

prometheus.remote_write "xscaler" {
endpoint {
url = "https://euw1-01.m.xscalerlabs.com/api/v1/push"
authorization {
type = "Bearer"
credentials = "<token>"
}
headers = { "X-Scope-OrgID" = "<tenant-id>" }
}
}

Option C — OpenTelemetry Collector

receivers:
snmp:
collection_interval: 60s
targets:
- endpoint: udp://192.168.1.1:161
community: public
version: v2c

processors:
batch:
timeout: 10s

exporters:
otlphttp/xscaler:
endpoint: https://euw1-01.m.xscalerlabs.com
headers:
Authorization: "Bearer <token>"
X-Scope-OrgID: "<tenant-id>"
compression: gzip

service:
pipelines:
metrics:
receivers: [snmp]
processors: [batch]
exporters: [otlphttp/xscaler]

Logs

Collect syslog messages from UniFi devices. Configure your device to send syslog to UDP 514 on the Alloy host, then add the following to your Alloy config:

loki.source.syslog "ubiquiti_syslog" {
listener {
address = "0.0.0.0:514"
protocol = "udp"
labels = {
job = "integrations/ubiquiti",
instance = constants.hostname,
}
}
forward_to = [loki.write.xscaler.receiver]
}

loki.write "xscaler" {
endpoint {
url = "https://euw1-01.l.xscalerlabs.com/api/v1/logs/push"

http_client_config {
authorization {
type = "Bearer"
credentials = env("XSCALER_TOKEN")
}
}

headers = { "X-Scope-OrgID" = env("XSCALER_TENANT_ID") }
}
}

Key metrics

MetricDescription
ifInOctetsBytes received per interface
ifOutOctetsBytes transmitted per interface
ifInErrorsInbound errors per interface
ifOutErrorsOutbound errors per interface
ifOperStatusInterface operational status
sysUpTimeSystem uptime
ipForwDatagramsIP datagrams forwarded