mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-29 05:11:51 +02:00
agent: add system-info endpoint
This commit is contained in:
@@ -42,6 +42,7 @@ func NewHandler() http.Handler {
|
||||
})
|
||||
mux.HandleMethods("GET", agent.EndpointHealth, CheckHealth)
|
||||
mux.HandleMethods("GET", agent.EndpointLogs, memlogger.LogsWS(nil))
|
||||
mux.HandleMethods("GET", agent.EndpointSystemInfo, SystemInfo)
|
||||
mux.ServeMux.HandleFunc("/", DockerSocketHandler())
|
||||
return mux
|
||||
}
|
||||
|
||||
17
agent/pkg/handler/system_info.go
Normal file
17
agent/pkg/handler/system_info.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/api/v1/utils"
|
||||
"github.com/yusing/go-proxy/internal/metrics"
|
||||
)
|
||||
|
||||
func SystemInfo(w http.ResponseWriter, r *http.Request) {
|
||||
info, err := metrics.GetSystemInfo(r.Context())
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
utils.RespondJSON(w, r, info)
|
||||
}
|
||||
Reference in New Issue
Block a user