NET-1986: Only report online hosts and external clients (#3375)

* feat(go): only report online hosts.

* feat(go): only report online external clients.

* feat(go): only report online hosts and external clients.
This commit is contained in:
Vishal Dalwadi 2025-03-17 07:35:17 -07:00 committed by GitHub
parent fb1052e6a5
commit 4c14cfd099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -82,11 +82,11 @@ func getUsage(w http.ResponseWriter, _ *http.Request) {
FailOvers int `json:"fail_overs"`
}
var serverUsage usage
hosts, err := logic.GetAllHosts()
hosts, err := logic.GetAllHostsWithStatus(models.OnlineSt)
if err == nil {
serverUsage.Hosts = len(hosts)
}
clients, err := logic.GetAllExtClients()
clients, err := logic.GetAllExtClientsWithStatus(models.OnlineSt)
if err == nil {
serverUsage.Clients = len(clients)
}

View file

@ -119,6 +119,7 @@ func GetAllHostsWithStatus(status models.NodeStatus) ([]models.Host, error) {
if len(host.Nodes) == 0 {
continue
}
nodes := GetHostNodes(&host)
for _, node := range nodes {
getNodeStatus(&node, false)