poll all the hosts
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5fcb83a1a2
commit
0751e80559
23
http.go
23
http.go
|
@ -30,10 +30,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if tmp == "/vms" {
|
if tmp == "/vms" {
|
||||||
s := shell.Wget("http://wilddog:2520/vms")
|
for _, hostname := range argv.Hosts {
|
||||||
var bytesSplice []byte
|
url := "http://" + hostname + ":2520/vms"
|
||||||
bytesSplice = s.Bytes()
|
log.Info("wget url =", url)
|
||||||
fmt.Fprintln(w, string(bytesSplice))
|
s := shell.Wget(url)
|
||||||
|
if s == nil {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var bytesSplice []byte
|
||||||
|
bytesSplice = s.Bytes()
|
||||||
|
// fmt.Fprintln(w, string(bytesSplice))
|
||||||
|
for _, line := range strings.Split(string(bytesSplice), "\n") {
|
||||||
|
if line == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fmt.Fprintln(w, hostname, line)
|
||||||
|
log.Info("LINE: =", hostname, line)
|
||||||
|
}
|
||||||
|
// log.Info("i, s =", hostname, i, s)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue