Merge pull request #300 from rancherio/configure-ip
Make the listen IP address configurable
This commit is contained in:
commit
2dac0d5c58
@ -35,6 +35,7 @@ import (
|
|||||||
"github.com/google/cadvisor/pages/static"
|
"github.com/google/cadvisor/pages/static"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var argIp = flag.String("listen_ip", "", "IP to listen on, defaults to all IPs")
|
||||||
var argPort = flag.Int("port", 8080, "port to listen")
|
var argPort = flag.Int("port", 8080, "port to listen")
|
||||||
var maxProcs = flag.Int("max_procs", 0, "max number of CPUs that can be used simultaneously. Less than 1 for default (number of cores).")
|
var maxProcs = flag.Int("max_procs", 0, "max number of CPUs that can be used simultaneously. Less than 1 for default (number of cores).")
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ func main() {
|
|||||||
|
|
||||||
glog.Infof("Starting cAdvisor version: %q on port %d", info.VERSION, *argPort)
|
glog.Infof("Starting cAdvisor version: %q on port %d", info.VERSION, *argPort)
|
||||||
|
|
||||||
addr := fmt.Sprintf(":%v", *argPort)
|
addr := fmt.Sprintf("%s:%d", *argIp, *argPort)
|
||||||
glog.Fatal(http.ListenAndServe(addr, nil))
|
glog.Fatal(http.ListenAndServe(addr, nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user