How to set/change Elastic Agent with same hostname

I have installed the elastic agent on two linux VM machines and they have the same hostname on both VMs. Unfortunately, only one shows up on my list of installed agents.

How do i change the name used for elastic agent when I install it or modify the configuration?

Thank you!

Hi @djarami726

Are you using self managed or fleet managed agen

Fleet managed agent - installed via token.

When You add the agent at the bottom. You can see where it says just host name or fully qualified. Did you try to fully qualified host name?

I saw that and I have it enabled, but only the short name shows up on the data and the list of agents

Having two hosts with the same hostname should make no difference for fleet as it uses a uuid to identify the agents.

Can you confirm that the agent is correctly running on both VMs?

Also, can you run the following request on Kibana Dev Tools and share the response?

GET kbn:/api/fleet/agents?page=1&perPage=20&showInactive=true&kuery=(local_metadata.host.hostname: "hostname")

Just replace hostname with the hostname of your VMs, This will query fleet for any agent with the specified hostname

Thank you. This was helpful.

I'm definitely not getting the fully qualified domain on the hostnames though but the data from this query gives me the ip address - so that will help me.

I still have to fix the hostname on the vm because the metrics data will have the same hostname for both agents/servers and that will give me incorrect information.

Thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.