# Https://localhost:8221/ errored!

**URL:** https://discuss.elastic.co/t/https-localhost-8221-errored/334328
**Category:** Elastic Agent
**Tags:** fleet
**Created:** [May 25, 2023, 1:21pm UTC](https://discuss.elastic.co/t/https-localhost-8221-errored/334328 "2023-05-25T13:21:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ethical20](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethical20/32/68123_2.png) [@ethical20](https://discuss.elastic.co/u/ethical20)
#### Post date: [May 25, 2023, 1:21pm UTC](https://discuss.elastic.co/t/https-localhost-8221-errored/334328/1 "2023-05-25T13:21:49Z")

</div>

Hi,

When installing elastic agent on remote servers It shows that it is successful and I can see logs in Kibana:

```auto
root@srv:~/elastic-agent-8.7.1-linux-x86_64# ./elastic-agent install --url=https://ip:port --fleet-server-es=https://ip:port --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2ODQ4NTUwODY5NjM6ZDMtd3Vy.... --enrollment-token=QktyWlVvZ0I0TC16Q05jdFU0ZzM6d2VaYU...== --certificate-authorities=/etc/ssl/certs/elasticsearch-ca.pem
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:
y
{"log.level":"info","@timestamp":"2023-05-25T12:40:25.110Z","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":407},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-05-25T12:40:27.853Z","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":803},"message":"Fleet Server - Starting","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-05-25T12:40:31.854Z","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":784},"message":"Fleet Server - Running on default policy with Fleet Server integration; missing config fleet.agent.id (expected during bootstrap process)","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-05-25T12:40:32.219Z","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":475},"message":"Starting enrollment to URL: https://w1.connect:8220/","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-05-25T12:40:33.992Z","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":273},"message":"Successfully triggered restart on running Elastic Agent.","ecs.version":"1.6.0"}
Successfully enrolled the Elastic Agent.
Elastic Agent has been successfully installed.

```

But after this In Kibana --\> Fleet --\> I can see the agent is updating then it goes offline. After checking status on agent I got this:

```auto
root@srv:~/elastic-agent-8.7.1-linux-x86_64# elastic-agent status
State: HEALTHY
Message: Running
Fleet State: FAILED
Fleet Message: fail to checkin to fleet-server: all hosts failed: 1 error occurred:
	* requester 0/1 to host https://localhost:8221/ errored: Post "https://localhost:8221/api/fleet/agents/52bd17c2-4c48-4791-9054-...../checkin?": dial tcp [::1]:8221: connect: connection refused

Components:
  * http/metrics (HEALTHY)
                    Healthy: communicating with pid '23443'
  * filestream (HEALTHY)
                    Healthy: communicating with pid '23445'
  * beat/metrics (HEALTHY)
                    Healthy: communicating with pid '23444'
  * log (HEALTHY)
                    Healthy: communicating with pid '23437'
  * system/metrics (HEALTHY)
                    Healthy: communicating with pid '23442'
  * nginx/metrics (HEALTHY)
                    Healthy: communicating with pid '23462'

```

I've been struggling since days on this with not enough or such error after googling on this.

Please HELP!

---

<div class="post-metadata">

### Author: ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)
#### Post date: [May 30, 2023, 5:56pm UTC](https://discuss.elastic.co/t/https-localhost-8221-errored/334328/2 "2023-05-30T17:56:15Z")

</div>

By the args you give during installation looks like the agent you're installing should run fleet-server, but it does not appear in the components list.

Are you intending to run a local fleet-server process?  
If so, please provide a diagnostics bundle so we can figure out what's killing the fleet-server process.  
If not, try to re-install without the `--fleet-server-*` flags

---

<div class="post-metadata">

### Author: ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)
#### Post date: [May 30, 2023, 6:05pm UTC](https://discuss.elastic.co/t/https-localhost-8221-errored/334328/3 "2023-05-30T18:05:07Z")

</div>

I see that the discussion is going on in [Fail to checkin to fleet-server](https://discuss.elastic.co/t/fail-to-checkin-to-fleet-server/334210), i'll post my comment there so we can have this discussion in the same thread.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 27, 2023, 6:05pm UTC](https://discuss.elastic.co/t/https-localhost-8221-errored/334328/4 "2023-06-27T18:05:32Z")

</div>

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