1
1
package main
2
2
3
3
import (
4
- "flag"
5
4
"fmt"
6
5
"log"
7
6
"net/http"
@@ -11,21 +10,22 @@ import (
11
10
"github.com/prometheus/client_golang/prometheus/promhttp"
12
11
"github.com/prometheus/common/version"
13
12
"github.com/prometheus/exporter-toolkit/web"
13
+ "gopkg.in/alecthomas/kingpin.v2"
14
14
15
15
kitlog "github.com/go-kit/kit/log"
16
16
)
17
17
18
18
const metricPrefix = "lvm_"
19
19
20
20
func main () {
21
- showVersion := flag . Bool ("version" , false , "Output version information and exit" )
22
- listenAddress := flag . String ("web.listen-address" , ":9845" , " The address to listen on for HTTP requests" )
23
- configFile := flag . String ("web.config" , "" , " Path to config yaml file that can enable TLS or authentication" )
24
- metricsPath := flag . String ("web.telemetry-path" , "/metrics" , " Path under which to expose metrics" )
25
- disableExporterMetrics := flag . Bool ("web.disable-exporter-metrics" , false , "Exclude metrics about the exporter itself" )
26
- cmd := flag . String ("command" , "/usr/sbin/lvm" , " Path to the LVM binary" )
21
+ showVersion := kingpin . Flag ("version" , "Output version information and exit" ). Bool ( )
22
+ listenAddress := kingpin . Flag ("web.listen-address" , "The address to listen on for HTTP requests" ). Default ( ":9845" ). String ( )
23
+ configFile := kingpin . Flag ("web.config" , "Path to config yaml file that can enable TLS or authentication" ). String ( )
24
+ metricsPath := kingpin . Flag ("web.telemetry-path" , "Path under which to expose metrics" ). Default ( "/metrics" ). String ( )
25
+ disableExporterMetrics := kingpin . Flag ("web.disable-exporter-metrics" , "Exclude metrics about the exporter itself" ). Bool ( )
26
+ cmd := kingpin . Flag ("command" , "Path to the LVM binary" ). Default ( "/usr/sbin/lvm" ). String ( )
27
27
28
- flag .Parse ()
28
+ kingpin .Parse ()
29
29
30
30
if * showVersion {
31
31
fmt .Println (version .Print ("prometheus-lvm-exporter" ))
0 commit comments