How can I list number/name of hosts connected to any specific Fleet server.
jsanz
(Jorge Sanz)
July 20, 2023, 2:04pm
2
Hi @Nishant_Chauhan , have you checked the Fleet API documentation? I understand you want to query the GET /agents
endpoint
This worked for me:
➜ curl -ks --request GET \
--user "${ELASTIC_USER}:${ELASTIC_PASSWORD}" \
--url "${KIBANA_HOST}/api/fleet/agents" \
--header 'Content-Type: application/json' \
| jq ".items[].id"
"c4e7c3ca-..."
"0591c27c-..."
"b1af37e0-..."
Thanks @jsanz !
This is good, however I want the list of agents talking to a particular fleet server.
Like i am able to get the fleet server name, but i want to list the agents talking to this fleet.
curl -ks --request GET \
--user "username:password" \
--url "http://0.0.0.0:5601/api/fleet/fleet_server_hosts" \
--header 'Content-Type: application/json' \
| jq
{
"items": [
{
"id": "beb26a70-26d4-11ee-8fec-b977c4acee53",
"name": "fleet1",
"host_urls": [
"https://x.x.x.x:8220"
],
"is_default": true,
"is_preconfigured": false
}
],
"page": 1,
"perPage": 10000,
"total": 1
}
I want to know hostnames of all agents talking/connected to "fleet1"
jsanz
(Jorge Sanz)
July 25, 2023, 10:00am
4
Hi sorry for my misunderstanding, yeah I don't think the fleet host is exposed in the Agents API and support for multiple Fleet server was added not that long ago so there may be opportunities to improve it.
Check this discussion so it provides some background
opened 10:08AM - 19 Nov 21 UTC
closed 10:28PM - 07 Nov 22 UTC
Team:Fleet
8.6-candidate
Meta
Over the past few weeks we have seen several users trying to run multiple fleet-… servers. This issue is to discuss the different scenarios and share an initial thoughts on how we could approach this. The goal is to come a conclusion and feed the information in the documentation and have it guideline for future features.
# Core concepts
* No load balancing: It is not the Elastic Agent jobs to load balance between multiple fleet-servers. This must be done at the infrastructure level through proxy or DNS.
* Fail over: An Elastic Agent supports multiple fleet-server urls as failover. By default the first url is picked.
* All info is shared across fleet-servers: Each fleet-server has always the same information no matter where it is deployed.
# Scenarios
Below is a list of scenarios which should describe the expected behaviours to follow the above core concepts. Not all scenarios are supported today.
## Scenario 1: Multiple fleet-servers, all Elastic Agent connect to all fleet-servers
In scenario 1 the users had multiple fleet-servers for redundancy or scale purpose. The user is expected to setup a proxy in front of the fleet-servers or use DNS to access the multiple fleet-servers. In the Fleet UI, a single fleet-server url is used.
## Scenario 2: Elastic Cloud only
The user connects all its Elastic Agent to the fleet-server in Elastic Cloud. As ESS already has a proxy in front and allows to spin up redundant fleet-servers, the setup is already as expected today.
## Scenario 3: Elastic Cloud fleet-server and on prem
The users is using Elastic Cloud with the fleet-server but also runs its on prem fleet-server to have the fleet-server closer to its Elastic Agents. By default the user wants to have its local fleet-servers to be used. In the Fleet UI, the user puts and additional fleet-server url before the Elastic Cloud fleet-server url. The user defined URL is the one used by default. In case the local fleet-server url is not reachable, Elastic Agents fall back to the Elastic Cloud fleet-server url.
The local fleet-server is expected to have the version in sync with the hosted fleet-server.
## Scenario 4: Multi policy with multi data center
In this scenario the user has multiple data centers with local fleet-servers and specific policies to each data center. In the Fleet UI, a global fleet-server is specified and in addition a fleet-server per policy can be specified. The fleet-server specified in the policy is the first in the list so it will be picked as the default for all Elastic Agent which are part of the policy.
You may want to open a feature request there with this requirement.
system
(system)
Closed
August 22, 2023, 10:00am
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.