Merge pull request #40 from prometheus/flag-cleanup

Make flag names consistent across projects.
This commit is contained in:
juliusv 2015-02-09 12:25:13 +01:00
commit 646d8de896
1 changed files with 9 additions and 8 deletions

View File

@ -22,11 +22,12 @@ import (
const subsystem = "exporter" const subsystem = "exporter"
var ( var (
configFile = flag.String("config", "", "Path to config file.") configFile = flag.String("config.file", "", "Path to config file.")
memProfile = flag.String("memprofile", "", "Write memory profile to this file.") memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.")
listeningAddress = flag.String("listen", ":8080", "Address to listen on.") listenAddress = flag.String("web.listen-address", ":9100", "Address on which to expose metrics and web interface.")
enabledCollectors = flag.String("enabledCollectors", "attributes,diskstats,filesystem,loadavg,meminfo,stat,textfile,time,netdev,netstat", "Comma-separated list of collectors to use.") metricsPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
printCollectors = flag.Bool("printCollectors", false, "If true, print available collectors and exit.") enabledCollectors = flag.String("collectors.enabled", "attributes,diskstats,filesystem,loadavg,meminfo,stat,textfile,time,netdev,netstat", "Comma-separated list of collectors to use.")
printCollectors = flag.Bool("collectors.print", false, "If true, print available collectors and exit.")
authUser = flag.String("auth.user", "", "Username for basic auth.") authUser = flag.String("auth.user", "", "Username for basic auth.")
authPass = flag.String("auth.pass", "", "Password for basic auth.") authPass = flag.String("auth.pass", "", "Password for basic auth.")
@ -171,17 +172,17 @@ func main() {
} }
} }
go func() { go func() {
http.Handle("/metrics", handler) http.Handle(*metricsPath, handler)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`<html> w.Write([]byte(`<html>
<head><title>Node Exporter</title></head> <head><title>Node Exporter</title></head>
<body> <body>
<h1>Node Exporter</h1> <h1>Node Exporter</h1>
<p><a href="/metrics">Metrics</a></p> <p><a href="` + *metricsPath + `">Metrics</a></p>
</body> </body>
</html>`)) </html>`))
}) })
err := http.ListenAndServe(*listeningAddress, nil) err := http.ListenAndServe(*listenAddress, nil)
if err != nil { if err != nil {
glog.Fatal(err) glog.Fatal(err)
} }