mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
26 lines
562 B
Go
26 lines
562 B
Go
package agent
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
cstructs "github.com/hashicorp/nomad/client/structs"
|
|
)
|
|
|
|
func (s *HTTPServer) ClientStatsRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
|
if s.agent.client == nil {
|
|
return nil, clientNotRunning
|
|
}
|
|
|
|
// Parse the ACL token
|
|
var args cstructs.ClientStatsRequest
|
|
s.parseToken(req, &args.AuthToken)
|
|
|
|
// Make the RPC
|
|
var reply cstructs.ClientStatsResponse
|
|
if err := s.agent.Client().ClientRPC("ClientStats.Stats", &args, &reply); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return reply.HostStats, nil
|
|
}
|