Skip to content

Commit

Permalink
Use kingpin for parsing flags, because of exitcodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
BartVerc committed Sep 24, 2018
1 parent fcf496f commit f38f196
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
cmd/lmsensors_exporter/lmsensors_exporter
10 changes: 6 additions & 4 deletions cmd/lmsensors_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
package main

import (
"flag"
"log"
"net/http"
"os"

"github.com/mdlayher/lmsensors"
"github.com/mdlayher/lmsensors_exporter"
"github.com/prometheus/client_golang/prometheus"
"gopkg.in/alecthomas/kingpin.v2"
)

var (
telemetryAddr = flag.String("telemetry.addr", ":9165", "address for lmsensors exporter")
metricsPath = flag.String("telemetry.path", "/metrics", "URL path for surfacing collected metrics")
app = kingpin.New("lmsensors_exporter", "Prometheus metrics exporter for lmsensors")
telemetryAddr = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry").Default(":9165").String()
metricsPath = app.Flag("web.telemetry-path","Path under which to expose metrics.").Default("/metrics").String()
)

func main() {
flag.Parse()
kingpin.MustParse(app.Parse(os.Args[1:]))

prometheus.MustRegister(lmsensorsexporter.New(lmsensors.New()))

Expand Down

0 comments on commit f38f196

Please sign in to comment.