GithubHelp home page GithubHelp logo

check_tplink's Introduction

check_tplink is a Nagios plugin which outputs stats for TP Link "Easy Smart Manage" switches that do not support SNMP.

I personally use it with LibreNMS as a "service" on an ICMP-only host. The idea was spawned in this LibreNMS community thread.

It has only been tested on TL-SG105E hardware version 5.0.

NOTE: These TP Link switches are very insecure. Logging in to the UI will automatically cause all requests from the origin IP to be authenticated even if they do not pass cookies/session data.

Sample Output

OK: ports connected: 3/5 | Port1Enabled=1 Port1LinkSpeed=125000000B Port1GoodTX=1186319c Port1BadTX=0c Port1GoodRX=2576883c Port1BadRX=0c Port2Enabled=1 Port2LinkSpeed=12000000B Port2GoodTX=1067312c Port2BadTX=0c Port2GoodRX=29067c Port2BadRX=0c Port3Enabled=1 Port3LinkSpeed=125000000B Port3GoodTX=2420380c Port3BadTX=0c Port3GoodRX=287621c Port3BadRX=0c Port4Enabled=1 Port4LinkSpeed=0B Port4GoodTX=991673c Port4BadTX=0c Port4GoodRX=599551c Port4BadRX=533c Port5Enabled=1 Port5LinkSpeed=0B Port5GoodTX=0c Port5BadTX=0c Port5GoodRX=0c Port5BadRX=0c TotalGoodTX=5665684c TotalBadTX=0c TotalGoodRX=3493122c TotalBadRX=533c PortsConnected=3 TotalPorts=5

Same output but more readable:

OK: ports connected: 3/5 | 
Port1Enabled=1 
Port1LinkSpeed=125000000B 
Port1GoodTX=1186319c 
Port1BadTX=0c 
Port1GoodRX=2576883c 
Port1BadRX=0c 
...
TotalGoodTX=5665684c 
TotalBadTX=0c 
TotalGoodRX=3493122c 
TotalBadRX=533c
PortsConnected=3
TotalPorts=5

LibreNMS screenshots

screenshot.png

Sample config: config.png

Statistics Provided

Note: c unit is a continuous counter for bytes as described in the Nagios plugin documentation.

Statistic Description Unit
PortNEnabled Whether the port is enabled 1 or 0
PortNGoodTX Good transmissions on port n c
PortNBadTX Bad transmissions on port n c
PortNGoodRX Good receives on port n c
PortNBadRX Bad receives on port n c
PortNLinkSpeed Link speed in bytes/s (100Mbps half is illustrated as 50Mbps) bytes
TotalGoodTX Aggregage good transmissions across all ports c
TotalBadTX Aggregate bad transmissions across all ports c
TotalGoodRX Aggregate good receives across all ports c
TotalBadRX Aggregate good receives across all ports c
PortsConnected Number of ports connected
TotalPorts Total number of ports

Installation

Download the proper binary from the releases page and place into the folder with the rest of your Nagios plugins. For LibreNMS users, see this documentation.

In LibreNMS, add your TP Link switch as an ICMP-only device (disable SNMP). You can do this through the add device page; there should be a toggle to disable SNMP.

Usage

Run check_tplink --help for help.

Usage: check_tplink [OPTIONS] --hostname <HOSTNAME>

Options:
  -H, --hostname <HOSTNAME>              TP Link switch hostname [env: HOSTNAME=]
  -l, --logname <LOGNAME>                Username [env: LOGNAME=] [default: admin]
  -a, --authentication <AUTHENTICATION>  Authentication password [env: AUTHENTICATION=]
  -h, --help                             Print help
  -V, --version                          Print version

Simple usage: check_tplink -H <hostname> -l admin -a <password>

Usage with password as environment variable:

export AUTHENTICATION=<password>
check_tplink -H <hostname> -l admin

Usage with password in special .tplink file:

echo "<password>" > .tplink
check_tplink -H <hostname> -l admin

check_tplink's People

Contributors

clete2 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.