# Sensu agent doesn't connect with the backend

**URL:** <https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529>\
**Category:** Sensu Go\
**Created:** [December 17, 2019, 4:19pm UTC](https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529 "2019-12-17T16:19:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyangui](https://avatars.discourse-cdn.com/v4/letter/e/c37758/32.png) [@eyangui](https://discourse.sensu.io/u/eyangui)\
**Post date:** [December 17, 2019, 4:19pm UTC](https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529/1 "2019-12-17T16:19:08Z")

</div>

Hello,

I work on sensu 5.16 on aws.

I install the agent on my ec2 instance, he’s up and running, i modify the backend–url in agent.yml find below :

## 

# agent configuration

## 

#backend-url:

# - “ws://10.133.49.245:3000”

#cache-dir: “/var/cache/sensu/sensu-agent”  
#config-file: “/etc/sensu/agent.yml”  
#disable-assets: false  
log-level: “debug” # available log levels: panic, fatal, error, warn, info, debug

Also i curl the api and it doesn’t return error.

But the backend doesn’t recognize the agent.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![jspaleta](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/jspaleta/32/141_2.png) [@jspaleta](https://discourse.sensu.io/u/jspaleta)\
**Post date:** [December 17, 2019, 4:21pm UTC](https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529/2 "2019-12-17T16:21:46Z")

</div>

Hey!  
Typically port 3000 is the sensu web-ui not the agent websocket.

Typically you’ll want something like “ws://X.X.X.X:8081” if you are using the default websocket port.

---

<div class="post-metadata">

**Author:** ![eyangui](https://avatars.discourse-cdn.com/v4/letter/e/c37758/32.png) [@eyangui](https://discourse.sensu.io/u/eyangui)\
**Post date:** [December 18, 2019, 9:11am UTC](https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529/3 "2019-12-18T09:11:56Z")

</div>

Hello,

Thanks for your quick reply.

I double check my cluster, i modify the backend.yml and the agent.yml to communicate on the right port.

Now my curl return a missing credentials and i saw that in the agent.yml there is an authentification confirguration do i have to create a user assign to my agent to authorize him a backend connection.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [December 18, 2019, 11:26am UTC](https://discourse.sensu.io/t/sensu-agent-doesnt-connect-with-the-backend/1529/4 "2019-12-18T11:26:25Z")

</div>

I’d look at @palourde’s answer in this other post:

> [@How to get "Authorization: Bearer $SENSU\_TOKEN"?](https://discourse.sensu.io/t/how-to-get-authorization-bearer-sensu-token/1526/2):
>
> Hi @masifpak, If you just need to manually query the API, you could export your user access token to your environment variables and use that as the bearer token; keep in mind that this access token is valid for a maximum of 5 minutes so you might need to refresh it often. Here’s how you could use it: $ eval $(sensuctl env) $ curl -H "Authorization: Bearer $SENSU\_ACCESS\_TOKEN" http://127.0.0.1:8080/api/[...] Alternatively, you could create and use an API key to authenticate against the API if …

The backend, with a couple of exceptions, requires authing to get any info, you’ll need to either use your token, or create an API key. See [/auth - Sensu Docs](https://docs.sensu.io/sensu-go/latest/api/auth/)
