-
Notifications
You must be signed in to change notification settings - Fork 5
/
status.go
35 lines (33 loc) · 893 Bytes
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package httpd
import (
"bufio"
"fmt"
"github.com/Symantec/Dominator/lib/html"
"net/http"
)
func statusHandler(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(w, req)
return
}
writer := bufio.NewWriter(w)
defer writer.Flush()
fmt.Fprintln(writer, "<title>System Health Agent status page</title>")
fmt.Fprintln(writer, "<body>")
fmt.Fprintln(writer, "<center>")
fmt.Fprintln(writer, "<h1>System Health Agent status page</h1>")
fmt.Fprintln(writer, "</center>")
html.WriteHeader(writer)
fmt.Fprintln(writer, "<h3>")
for _, htmlWriter := range htmlWriters {
if requestWriter, ok := htmlWriter.(RequestHtmlWriter); ok {
requestWriter.RequestWriteHtml(writer, req)
} else {
htmlWriter.WriteHtml(writer)
}
}
fmt.Fprintln(writer, "</h3>")
fmt.Fprintln(writer, "<hr>")
html.WriteFooter(writer)
fmt.Fprintln(writer, "</body>")
}