diff --git a/README.md b/README.md index f5419c7..d7d481c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ Download from [releases](https://github.com/fffonion/tplink-plug-exporter/releas docker run -d -p 9233:9233 fffonion/tplink-plug-exporter ``` +### Usage +Use the -h flag to see full usage: + +``` +$ tplink-plug-exporter -h +Usage of tplink-plug-exporter: + -metrics.listen-addr string + listen address for tplink-plug exporter (default ":9233") +``` + ## Grafana dashboard Search for `Kasa` inside grafana or install from https://grafana.com/grafana/dashboards/10957 diff --git a/main.go b/main.go index 4918748..87b0c06 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "net/http" "github.com/prometheus/common/log" @@ -9,7 +10,10 @@ import ( ) func main() { + var metricsAddr = flag.String("metrics.listen-addr", ":9233", "listen address for tplink-plug exporter") + + flag.Parse() s := exporter.NewHttpServer() - log.Infoln("Accepting Prometheus Requests on :9233") - log.Fatal(http.ListenAndServe(":9233", s)) + log.Infof("Accepting Prometheus Requests on %s", *metricsAddr) + log.Fatal(http.ListenAndServe(*metricsAddr, s)) }