parent
8724a07b0d
commit
9d08114b93
51
http.go
51
http.go
|
@ -6,7 +6,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
||||||
"go.wit.com/lib/virtigoxml"
|
"go.wit.com/lib/virtigoxml"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -21,43 +20,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var route string
|
var route string
|
||||||
route = cleanURL(r.URL.Path)
|
route = cleanURL(r.URL.Path)
|
||||||
|
|
||||||
// show only what droplets should be running but are missing
|
|
||||||
if route == "/missing" {
|
|
||||||
var count int
|
|
||||||
var missing int
|
|
||||||
for _, d := range me.cluster.Droplets {
|
|
||||||
if d.StartState != pb.DropletState_ON {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
count += 1
|
|
||||||
if d.CurrentState == pb.DropletState_ON {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
missing += 1
|
|
||||||
fmt.Fprintln(w, d.Hostname, "current state:", d.CurrentState)
|
|
||||||
}
|
|
||||||
if missing == 0 {
|
|
||||||
fmt.Fprintln(w, "all", count, "droplets set to run are running")
|
|
||||||
} else {
|
|
||||||
fmt.Fprintln(w, missing, "droplets missing")
|
|
||||||
fmt.Fprintln(w, count, "droplets should be running")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if route == "/favicon.ico" {
|
|
||||||
// w.Header().Set("Content-Type", "image/svg+xml")
|
|
||||||
w.Header().Set("Content-Type", "image/png")
|
|
||||||
writeFile(w, "ipv6.png")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if route == "/goReference.svg" {
|
|
||||||
w.Header().Set("Content-Type", "image/svg+xml")
|
|
||||||
writeFile(w, "goReference.svg")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if route == "/uptime" {
|
if route == "/uptime" {
|
||||||
ok, s := uptimeCheck()
|
ok, s := uptimeCheck()
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -143,6 +105,19 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if route == "/favicon.ico" {
|
||||||
|
// w.Header().Set("Content-Type", "image/svg+xml")
|
||||||
|
w.Header().Set("Content-Type", "image/png")
|
||||||
|
writeFile(w, "ipv6.png")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if route == "/goReference.svg" {
|
||||||
|
w.Header().Set("Content-Type", "image/svg+xml")
|
||||||
|
writeFile(w, "goReference.svg")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
log.Warn("BAD URL =", route)
|
log.Warn("BAD URL =", route)
|
||||||
fmt.Fprintln(w, "BAD URL tmp =", route)
|
fmt.Fprintln(w, "BAD URL tmp =", route)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue