TP-Link Easy Smart Switches are a family of managed switches capable of supporting QoS, VLANs and Link Aggregation Groups (LAGs). They are managed through a web based interface, giving access a number of functions, including basic packets counters per-port. Unfortunately, these switches do not implement SNMP for access to these counters, nor do they appear to implement a discrete URL for direct access to this information. This utility addresses this issue to produce per-port statistics from a single command line invocation with output that can be trivially parsed for formatted output, or entered into a monitoring system like Zabbix.
This project has been tested against TP-Link switch models TL-SG1016DE and TL-SG108E. It should also be compatible with the other members of this family, including the TL-SG105E and TL-SG1024DE.
essstat.py is a lightweight utility is used to pull port statistics from the switch and output in a readily parsable format. Additional code will be added to parse and either output or store these statistics. This lightweight Python application performs a quick login through the switch's web based administrative interface, and then queries the unit for the current port statistics. Credentials for accessing the unit are passed on the command line. The utility was coded with Python 3.6 and uses the Beautiful Soup library.
TPhost IP address or hostname of switchoptional arguments:
-h, --help show this help message and exit -u TPuser, --username TPuser username for swtich access -p TPpswd, --password TPpswd password for swtich access -d, --debug activate debugging output
Peter Smode
psmode [at] kitsnet.us