Skip to main content

UniFi/EdgeSwitch port-counter plugin for rdc-proxy.

Project description

rdc-proxy-unifi

UniFi/EdgeSwitch port-counter plugin for rdc-proxy.

Adds a "switch" side channel to the rdc-proxy dashboard containing live port counters polled via SSH from a UniFi/EdgeSwitch running swctrl.

Prerequisites

  • rdc-proxy already installed on the same host (it provides the plugin loader + dashboard).
  • A UniFi/EdgeSwitch (any model supporting swctrl port show counters).
  • An SSH key that the rdc-proxy service user can use to log into the switch.

Install

Assuming rdc-proxy is already running at /opt/rdc-proxy:

# Clone and install into the rdc-proxy venv
sudo git clone https://github.com/andrewroydshayes/rdc-proxy-unifi.git /opt/rdc-proxy-unifi
sudo /opt/rdc-proxy/venv/bin/pip install /opt/rdc-proxy-unifi

# Place your SSH key where the service can read it (0600 root:root)
sudo cp ~/.ssh/id_rsa_unifi /etc/rdc-proxy/id_rsa_unifi
sudo chmod 600 /etc/rdc-proxy/id_rsa_unifi

# Configure via env vars in /etc/rdc-proxy/rdc-proxy.env (see below), then:
sudo systemctl restart rdc-proxy

The rdc-proxy service will log [plugins] loaded: unifi on startup.

Or use the included installer:

curl -fsSL https://raw.githubusercontent.com/andrewroydshayes/rdc-proxy-unifi/main/install/install-unifi.sh \
  | sudo bash

Configuration

Add to /etc/rdc-proxy/rdc-proxy.env:

RDC_UNIFI_SWITCH_IP=10.0.0.97
RDC_UNIFI_SWITCH_USER=root
RDC_UNIFI_SSH_KEY=/etc/rdc-proxy/id_rsa_unifi
RDC_UNIFI_PORT_ID=9
RDC_UNIFI_POLL_INTERVAL=30
RDC_UNIFI_SIDE_CHANNEL=switch

All env vars have defaults — only set the ones you need to change.

How the side channel surfaces

The plugin calls state.update_side_channel("switch", {...counters...}) once per poll. rdc-proxy's dashboard collector merges all side channels into the JSON returned by /api/status, under side_channels. For UI back-compat the "switch" channel is ALSO mirrored at the top level as switch in each dashboard history point.

Development

pip install -e ".[dev]"
pytest

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rdc_proxy_unifi-0.2.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rdc_proxy_unifi-0.2.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file rdc_proxy_unifi-0.2.0.tar.gz.

File metadata

  • Download URL: rdc_proxy_unifi-0.2.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rdc_proxy_unifi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c09fe0c549619e9ff13fca125422e45f543dbd8e7540bc8fbd205bdfd23bb509
MD5 219208673b1b55a9aa122b2eec21dba7
BLAKE2b-256 ae9a890f1f97a2e730ce763c003e0f28761cb47d26591c462207bfef15dbbb3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdc_proxy_unifi-0.2.0.tar.gz:

Publisher: publish.yml on andrewroydshayes/rdc-proxy-unifi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdc_proxy_unifi-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rdc_proxy_unifi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84d3dd64f3887aa45a3c23481a83619bae5d83f8a0a6e6609cfcdf3bf5222c1a
MD5 314309ab5bb47993f847b5a7ba7b9668
BLAKE2b-256 6030db097e47c89c9fd07ad5b0c6d4cf011833f4434a297f823317796ac8e4ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdc_proxy_unifi-0.2.0-py3-none-any.whl:

Publisher: publish.yml on andrewroydshayes/rdc-proxy-unifi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page