From b572ef2aefb7cf63674a593817c2113f9d493183 Mon Sep 17 00:00:00 2001 From: Lou Knauer Date: Thu, 24 Mar 2022 10:35:52 +0100 Subject: [PATCH] Add template for status page --- routes.go | 3 +++ server.go | 4 ++++ templates/monitoring/status.tmpl | 14 ++++++++++++++ templates/templates.go | 1 + 4 files changed, 22 insertions(+) create mode 100644 templates/monitoring/status.tmpl diff --git a/routes.go b/routes.go index aa51895..63350e5 100644 --- a/routes.go +++ b/routes.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "net/http" "net/url" "strconv" @@ -39,6 +40,7 @@ var routes []Route = []Route{ {"/monitoring/systems/{cluster}", "monitoring/systems.tmpl", "Cluster - ClusterCockpit", false, setupClusterRoute}, {"/monitoring/node/{cluster}/{hostname}", "monitoring/node.tmpl", "Node - ClusterCockpit", false, setupNodeRoute}, {"/monitoring/analysis/{cluster}", "monitoring/analysis.tmpl", "Analaysis - ClusterCockpit", true, setupAnalysisRoute}, + {"/monitoring/status/{cluster}", "monitoring/status.tmpl", "Status of - ClusterCockpit", false, setupClusterRoute}, } func setupHomeRoute(i InfoType, r *http.Request) InfoType { @@ -118,6 +120,7 @@ func setupNodeRoute(i InfoType, r *http.Request) InfoType { vars := mux.Vars(r) i["cluster"] = vars["cluster"] i["hostname"] = vars["hostname"] + i["id"] = fmt.Sprintf("%s (%s)", vars["cluster"], vars["hostname"]) from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to") if from != "" || to != "" { i["from"] = from diff --git a/server.go b/server.go index 197ed6e..28f210a 100644 --- a/server.go +++ b/server.go @@ -13,6 +13,7 @@ import ( "net/url" "os" "os/signal" + "runtime/debug" "strings" "sync" "syscall" @@ -476,6 +477,9 @@ func main() { api.OngoingArchivings.Wait() }() + if os.Getenv("GOGC") == "" { + debug.SetGCPercent(25) + } systemdNotifiy(true, "running") wg.Wait() log.Print("Gracefull shutdown completed!") diff --git a/templates/monitoring/status.tmpl b/templates/monitoring/status.tmpl new file mode 100644 index 0000000..15aff69 --- /dev/null +++ b/templates/monitoring/status.tmpl @@ -0,0 +1,14 @@ +{{define "content"}} +
+{{end}} + +{{define "stylesheets"}} + +{{end}} +{{define "javascript"}} + + +{{end}} diff --git a/templates/templates.go b/templates/templates.go index c5e248d..0d0b956 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -48,6 +48,7 @@ func init() { "monitoring/list.tmpl", "monitoring/user.tmpl", "monitoring/systems.tmpl", + "monitoring/status.tmpl", "monitoring/node.tmpl", "monitoring/analysis.tmpl", }