Add option to print out available collectors.

Fix typo.
This commit is contained in:
Brian Brazil 2014-06-04 14:09:33 +01:00
parent d2bc8b7cca
commit cbb91fb332
1 changed files with 10 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
@ -24,7 +25,8 @@ var (
configFile = flag.String("config", "node_exporter.conf", "config file.")
memProfile = flag.String("memprofile", "", "write memory profile to this file")
listeningAddress = flag.String("listen", ":8080", "address to listen on")
enabledCollectors = flag.String("enabledCollectors", "attributes,diskstats,loadavg,meminfo,netdev", "comma seperated list of collectors to use")
enabledCollectors = flag.String("enabledCollectors", "attributes,diskstats,loadavg,meminfo,netdev", "comma-seperated list of collectors to use")
printCollectors = flag.Bool("printCollectors", false, "If true, print available collectors and exit")
interval = flag.Duration("interval", 60*time.Second, "refresh interval")
scrapeDurations = prometheus.NewDefaultHistogram()
metricsUpdated = prometheus.NewGauge()
@ -32,6 +34,13 @@ var (
func main() {
flag.Parse()
if *printCollectors {
fmt.Printf("Available collectors:\n")
for n, _ := range collector.Factories {
fmt.Printf(" - %s\n", n)
}
return
}
registry := prometheus.NewRegistry()
collectors, err := loadCollectors(*configFile, registry)
if err != nil {