parent
d2bc8b7cca
commit
cbb91fb332
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -24,7 +25,8 @@ var (
|
||||||
configFile = flag.String("config", "node_exporter.conf", "config file.")
|
configFile = flag.String("config", "node_exporter.conf", "config file.")
|
||||||
memProfile = flag.String("memprofile", "", "write memory profile to this file")
|
memProfile = flag.String("memprofile", "", "write memory profile to this file")
|
||||||
listeningAddress = flag.String("listen", ":8080", "address to listen on")
|
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")
|
interval = flag.Duration("interval", 60*time.Second, "refresh interval")
|
||||||
scrapeDurations = prometheus.NewDefaultHistogram()
|
scrapeDurations = prometheus.NewDefaultHistogram()
|
||||||
metricsUpdated = prometheus.NewGauge()
|
metricsUpdated = prometheus.NewGauge()
|
||||||
|
@ -32,6 +34,13 @@ var (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
if *printCollectors {
|
||||||
|
fmt.Printf("Available collectors:\n")
|
||||||
|
for n, _ := range collector.Factories {
|
||||||
|
fmt.Printf(" - %s\n", n)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
registry := prometheus.NewRegistry()
|
registry := prometheus.NewRegistry()
|
||||||
collectors, err := loadCollectors(*configFile, registry)
|
collectors, err := loadCollectors(*configFile, registry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue