Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
Changed to kingpin flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
BartVerc committed Sep 28, 2018
1 parent 1da1f30 commit 97d1e6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
/libvirt_exporter
15 changes: 8 additions & 7 deletions libvirt_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ package main

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

"github.com/libvirt/libvirt-go"
"gopkg.in/alecthomas/kingpin.v2"
"github.com/prometheus/client_golang/prometheus"

libvirt "github.com/libvirt/libvirt-go"

"github.com/kumina/libvirt_exporter/libvirt_schema"
)

Expand Down Expand Up @@ -435,11 +435,12 @@ func (e *LibvirtExporter) Collect(ch chan<- prometheus.Metric) {

func main() {
var (
listenAddress = flag.String("web.listen-address", ":9177", "Address to listen on for web interface and telemetry.")
metricsPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
libvirtURI = flag.String("libvirt.uri", "qemu:///system", "Libvirt URI from which to extract metrics.")
app = kingpin.New("libvirt_exporter", "Prometheus metrics exporter for libvirt")
listenAddress = app.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9177").String()
metricsPath = app.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").String()
libvirtURI = app.Flag("libvirt.uri", "Libvirt URI from which to extract metrics.").Default("qemu:///system").String()
)
flag.Parse()
kingpin.MustParse(app.Parse(os.Args[1:]))

exporter, err := NewLibvirtExporter(*libvirtURI)
if err != nil {
Expand Down

0 comments on commit 97d1e6f

Please sign in to comment.