Skip to content

Commit

Permalink
feat: Change homepage content (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bpazy committed May 22, 2024
1 parent d58498c commit d4e9ae1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cmd/padavan_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,32 @@ func main() {
})
// 处理根路径请求,提供简单信息页面
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
b := ` <html> <head> <title>padavan_exporter</title> </head> <body> <span> Here is <a href="/metrics">/metrics</a> </span> <br><span>Here is <a href="https://github.com/Bpazy/padavan_exporter">padavan_exporter</a></span> </body> </html>`
_, _ = fmt.Fprintln(w, b)
_, _ = fmt.Fprintln(w, homePage())
})

log.Printf("Start server at %s", *la)
// 启动 HTTP 服务
log.Fatal(http.ListenAndServe(*la, nil))
}

func homePage() string {
return `
<html>
<head>
<title>padavan_exporter</title>
</head>
<body>
<h2>padavan_exporter</h2>
<span>See docs at <a href="https://github.com/Bpazy/padavan_exporter">https://github.com/Bpazy/padavan_exporter</a></span>
<br>
<br>
<span> Useful endpoints: </span>
<br>
<span> <a href="/metrics">metrics</a> <span> - available service metrics </span>
</body>
</html>`
}

// initSshClient 函数用于初始化并返回一个 SSH 客户端。
// 该客户端用于与 Padavan 设备进行 SSH 连接以收集监控数据。
func initSshClient() *ssh.Client {
Expand Down

0 comments on commit d4e9ae1

Please sign in to comment.