From e7f281e8f44ebfcf9e0f8bbec4aa04ef191a24b4 Mon Sep 17 00:00:00 2001 From: AJ Date: Mon, 30 Apr 2018 21:18:52 +0100 Subject: [PATCH] fix #1 add / replace "flag" pkg to support env config, update README.md section --- README.md | 11 +++++++++++ pve_exporter.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce9b17d..759cec5 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,17 @@ Usage of ./pve_exporter: -version show version and exit ``` +### Configuration + +| Type | Flag | Environment | +| ------ | :------------------------------ | :----------------------------- | +| string | -listen-address :9090 | LISTEN_ADDRESS=:9090 | +| string | -telemetry-path /metrics | TELEMETRY_PATH=/metrics | +| string | -pve-url https://127.0.0.1:8006 | PVE_URL=https://127.0.0.1:8006 | +| int | -timeout 5 | TIMEOUT=5 | +| string | -user root | USER=root | +| string | -password 1234 | PASSWORD=1234 | +| string | -realm pam | REALM=pam | ## Metrics diff --git a/pve_exporter.go b/pve_exporter.go index 0f2dc76..e145ccd 100644 --- a/pve_exporter.go +++ b/pve_exporter.go @@ -4,7 +4,6 @@ import ( "bytes" "crypto/tls" "encoding/json" - "flag" "fmt" "io/ioutil" "net/http" @@ -12,6 +11,7 @@ import ( "strings" "time" + "github.com/namsral/flag" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/log"