Skip to content

burningsunrise/tplink-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tplink-exporter | prometheus

A tplink exporter for prometheus, written in go. Uses ants, logrus, godotenv, prometheus

Ants is used to create a 20 item pool of goroutines. Feel free to change that number here

Supported/Tested Hardware & Firmware:

  • T2600G = 3.0.3fw
  • T1600G = 3.0.3fw

Feel free to try on other TPLink hardware, and let me know if it works!

Here is an example of CPU usage on a switch using this software vs using the built in STP metrics tplink-exporter-cpu-usage

Building and Running

tplink-exporter can be run directly from binary or in a docker container, choose whichever method you prefer.

To be able to scan devices, the exporter expects a file named config.yaml in the same directory as it, with the devices ip address or dns address. If you are not comfortable with putting credentials in a yaml file, you may also use your username and password as a environment variable.

Building from source (*nix):

cd ~
git clone https://github.com/burningsunrise/tplink-exporter.git && cd tplink-exporter
go mod tidy
GOOS=linux GOARCH=amd64 go build -o tplink-exporter .
chmod +x tplink-exporter
./tplink-exporter

Building docker container (*nix):

cd ~
git clone https://github.com/burningsunrise/tplink-exporter.git && cd tplink-exporter
docker buildx build --platform linux/amd64 -t $REGISTRY.com/tplink-exporter:latest --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --push .

docker-compose example:

version: '3.9'
services:
  tplink-exporter:
    container_name: tplink-exporter
    image: $REGISTRY.com/tplink-exporter:latest
    restart: unless-stopped
    ports:
      - 9797:9797
    environment:
      - USER=${SWITCHUSER}
      - PASSWORD=${SWITCHPASS}
    volumes:
      - /home/$USER/tplink-exporter/config.yaml:/config.yaml

config.yaml example:

devices:
  - 10.1.1.2
  - myswitch.dns.lan
# May include username and password in config.yaml
# Alternatively you can use the USER and PASSWORD
# env variables, e.x.:
# export USER=username
# export PASSWORD=password
user: username
password: password

Current Metrics Exported

Name Description Metric Labels
port_tx_metric Shows tx packets on the hosts port Tx Packet #'s portnumber
host
port_rx_metric Shows rx packets on the hosts port Rx Packet #'s portnumber
host
port_speed_metric Shows the hosts port speed Port speed portnumber
host
port_vlans_metric Shows the vlans on port number Port numbner vlanname
vlanid
host
port
switch_memory_metric Shows the specific switch memory Memory % host
macaddress
switch_cpu_metric Shows the specific switch cpu Cpu % host
macaddress
port_badrx_metric Shows bad rx packets on the hosts port BAD Rx Packet #'s portnumber
host
port_badtx_metric Shows bad tx packets on the hosts port BAD Tx Packet #'s portnumber
host
port_broadcastrx_metric Shows broadcast rx packets the hosts port Broadcast Rx #'s portnumber
host
port_broadcasttx_metric Shows broadcast tx packets the hosts port Broadcast Tx #'s portnumber
host
port_multicasttx_metric Shows multicast tx packets on the hosts port Multicast Tx #'s portnumber
host
port_multicastrx_metric Shows multicast rx packets on the hosts port Multicast Rx #'s portnumber
host
port_unicasttx_metric Shows unicast tx packets on the hosts port Unicast Tx #'s portnumber
host
port_unicastrx_metric Shows unicast rx packets on the hosts port Unicast Rx #'s portnumber
host
switch_generalinfo_metric Shows general information about the switch with temperature as a metric Temperature devicelocation
sysdescription
host
hwversion
fmversion
macaddress
systime
runtime
serialnum

About

prometheus exporter for tplink T2600G or tplink T1600G switches

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published