Debian Codegraph @

README.md

raw symbols SCIP
1 # tplink-plug-exporter
2
3 Export TP-Link Smart Plug metrics to grafana dashboard
4
5 ## Install
6
7 Download from [releases](https://github.com/fffonion/tplink-plug-exporter/releases) or run from docker
8
9 ```
10 docker run -d -p 9233:9233 fffonion/tplink-plug-exporter
11 ```
12
13 ### Usage
14 Use the -h flag to see full usage:
15
16 ```
17 $ tplink-plug-exporter -h
18 Usage of tplink-plug-exporter:
19 -metrics.listen-addr string
20 listen address for tplink-plug exporter (default ":9233")
21 ```
22
23 ## Grafana dashboard
24
25 Search for `Kasa` inside grafana or install from https://grafana.com/grafana/dashboards/10957
26 ![img](https://grafana.com/api/dashboards/10957/images/6954/image)
27
28 ## Sample prometheus config
29
30 ```yaml
31 # scrape kasa devices
32 scrape_configs:
33 - job_name: 'kasa'
34 static_configs:
35 - targets:
36 # IP of your smart plugs
37 - 192.168.0.233
38 - 192.168.0.234
39 metrics_path: /scrape
40 relabel_configs:
41 - source_labels : [__address__]
42 target_label: __param_target
43 - source_labels: [__param_target]
44 target_label: instance
45 - target_label: __address__
46 # IP of the exporter
47 replacement: localhost:9233
48
49 # scrape kasa_exporter itself
50 - job_name: 'kasa_exporter'
51 static_configs:
52 - targets:
53 # IP of the exporter
54 - localhost:9233
55 ```
56
57 ## Docker Build Instructions
58
59 Build for both `arm64` and `amd64`:
60 ```
61 docker build -t <image-name>:latest-arm64 --platform linux/arm64 --build-arg GOARCH=arm64 .
62 docker build -t <image-name>:latest-amd64 --platform linux/amd64 --build-arg GOARCH=amd64 .
63 ```
64
65 Merge them in one manifest:
66 ```
67 docker manifest create <image-name>:latest --amend <image-name>:latest-arm64 --amend <image-name>:latest-amd64
68 docker manifest push <image-name>:latest
69 ```
70
71 ## See also
72
73 - Original reverse engineering work: https://github.com/softScheck/tplink-smartplug