Skip to content

StanislawHorna/Omada_Exporter_GO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Omada Exporter

Prometheus Exporter written in Go for TP-Link Omada SDN.

This exporter is built with native Go HTTP and prometheus/client_golang libraries to expose metrics from Omada SDN to Prometheus. Metrics are queried live from the controller when the /metrics endpoint is accessed, avoiding unnecessary polling when not in use.

Supports both Omada OpenAPI and Web API to accommodate current platform limitations.

Grafana Dashboards

image

image

image

image

🚀 Getting Started

Prerequisites

  • Omada Controller with configured:
  • Prometheus (or another metrics scraper) to collect and store the metrics
  • Grafana to visualize the data using built-in dashboards
  • (Optional) Grafana Loki if you want to collect and view logs from the exporter

Setup

  1. Clone the Repository
git clone https://github.com/StanislawHorna/Omada_Exporter_Go.git
cd Omada_Exporter_Go
  1. Create .env File with variables from Configuration Parameters
LOG_LEVEL=info

OMADA_URL=https://<omada_ip_address>:<omada_port>
OMADA_SITE_NAME=<your_omada_site_name>
OMADA_CLIENT_ID=<open_api_client_id>
OMADA_CLIENT_SECRET=<open_api_client_secret>
OMADA_USERNAME=<web_ui_username>
OMADA_PASSWORD=<web_ui_password>

LOKI_URL=http://<loki_ip_address>:<loki_port>
LOKI_ENV=prod
LOKI_APP_VERSION=1.0.0
  1. Build the Docker image
docker build -t omada_exporter .
  1. Run the container
docker run -d \
  --env-file .env \
  -p 8080:8080 \
  --name omada_exporter \
  omada_exporter
  1. Configure Prometheus to scrape the data:
scrape_configs:
  - job_name: "Omada"
    static_configs:
      - targets: ["<docker_host_ip>:8080"]
        labels:
          device_name: "<omada_controller_friendly_name>"
    metrics_path: /metrics
  1. Import dashboards from Dashboards directory to your Grafana instance.

Tip

After starting up the exporter navigate to http://"<docker_host_ip>:8080/metrics and check omada_http_client_requests_total metrics. There should be no metrics with code different different than 200

Omada Authentication Setup

  • OpenAPI Client – Created via: Settings -> Platform Integration. Assign admin role for full API access.
  • Service User – Create under: Account section at Global level. Assign viewer role for read-only access.

Configuration Parameters

All configuration values are read from environment variables. These can be provided via a .env file, environment variables in your system, or directly in Docker Compose.

Variable Description Default
LOG_LEVEL Logging verbosity level (debug, info, warn, error) error
OMADA_URL Full base URL to the Omada controller (e.g., https://192.168.1.1:8043) -
OMADA_SITE_NAME Name of the site you wish to monitor -
OMADA_CLIENT_ID OpenAPI Client ID created in Omada Platform Integration -
OMADA_CLIENT_SECRET OpenAPI Client Secret -
OMADA_USERNAME Username for Web API access -
OMADA_PASSWORD Password for Web API access -

Tested on devices:

About

Prometheus Exporter written in Go for TP-Link Omada SDN.

Topics

Resources

Stars

Watchers

Forks

Contributors