The Zyxel GS1200-5/GS1200-8 is a small and cheap managed switch, capable of handling 16Gbps across 5 or 8 ports, so say the specs.
Unfortunately the firmware does not implement SNMP or another standard for collecting port metrics.
It does, however, display metrics in the web gui. These metrics are set in a
javascript file at the uri /link_data.js
.
This program will automatically log in to the web gui, evaluate the script, and output metrics for use by Prometheus.
The program can be configured by setting environment variables prior to running:
name | required | description |
---|---|---|
GS1200_ADDRESS |
yes | IP address of the GS1200-5/GS1200-8 |
GS1200_PASSWORD |
yes | Password to log on with |
GS1200_PORT |
no | Port number to listen on, default 9934 |
Example:
$ go build
$ export GS1200_ADDRESS=192.168.1.3
$ export GS1200_PASSWORD=1234
$ ./gs1200-exporter
Or just use the argument flags:
$ ./gs1200-exporter --help
Usage of ./gs1200-exporter:
-address string
IP address or hostname of the GS1200 (default "192.168.1.3")
-password string
Password to log on to the GS1200 (default "********")
-port string
Port on which to expose metrics. (default "9934")
$ docker run \
--detach \
--name gs1200-exporter \
--rm \
--publish 9934:9934 \
--env GS1200_ADDRESS=192.168.1.3 \
--env GS1200_PASSWORD=1234 \
ghcr.io/robinelfrink/gs1200-exporter:latest
Example docker-compose.yml
:
version: '3'
services:
gs1200-exporter:
container_name: gs1200-exporter
image: ghcr.io/robinelfrink/gs1200-exporter:latest
environment:
- GS1200_ADDRESS=192.168.1.3
- GS1200_PASSWORD=1234
ports:
- 9934:9934
This application has been tested with V2.00 firmwares up to V2.00(ABME.3).