# Sensu backend not picking up subscriptions added to a host's agent.yml

**URL:** <https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846>\
**Category:** Sensu Go\
**Created:** [June 3, 2020, 6:39pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846 "2020-06-03T18:39:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 6:39pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/1 "2020-06-03T18:39:01Z")

</div>

I have a host that had a subscriptions in its agent.yaml configuration. Sensu sees that subscription just fine.

I added two more subscriptions to the agent.yml file, and restarted the sensu agent. The sensu backend does not see these new subscriptions.

I deleted the host (entity) out of the sensu backend, and when I restart the agent on that host, the sensu backend can see the host again immediately, but it still only lists one of those subscriptions. What am I missing?

---

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 6:43pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/3 "2020-06-03T18:43:21Z")

</div>

Yes, there are 2 checks in the subscription that I’m trying to add. Sensuctl sees them. (One is a check that I’m trying something new with - instead of running an asset, its just running a script on the host, like /opt/myscript.sh).

---

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 7:08pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/4 "2020-06-03T19:08:38Z")

</div>

Tried deleting that weird check from the description (now the subscription only has a simple process check in it), and removing one of the subscriptions from the host, and removing the host from sensu and letting sensu rediscover it again…still no dice.

---

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 7:37pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/6 "2020-06-03T19:37:56Z")

</div>

So, calling my host `<hostname>`. It’s in the namespace stg01. It is already subscribed to ‘adb’, I’m trying to subscribe it to ‘postgres’ and ‘base’ also, right now just focusing on the ‘postgres’ subscription.

agent.yml on `<hostname>`:

```
[alison.mccrea@<hostname>]$ sudo cat /etc/sensu/agent.yml
---
backend-url:
- wss://<sensu_backend>:8081
subscriptions:
- base
- postgres
- adb
namespace: stg01

```

On the sensu backend:

```
[root@<sensu.backend> ~]$ sensuctl entity info <hostname> --namespace stg01
=== <hostname>
Name: <hostname>
Entity Class: agent
Subscriptions: adb, entity:<hostname>
Last Seen: 2020-06-03 19:33:26 +0000 UTC
Hostname: <hostname>
OS: linux
Platform: centos
Platform Family: rhel
Platform Version: 6.10
Auto-Deregistration: false
Deregistration Handler:

```

The check itself:

```
[root@<sensu.backend> ~]$ sensuctl check list --namespace stg01 | grep postgres
  postmaster_process check-process.rb -p postmaster 300 0 0 postgres test_handler sensu-ruby-runtime,sensu-plugins-process-checks true false
```

---

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 7:57pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/7 "2020-06-03T19:57:10Z")

</div>

Nevermind. I found the problem. It’s a problem I’ve been having on some hosts for some reason –

```
[alison.mccrea@<hostname>]$ sudo service sensu-agent restart
sensu-agent started
[alison.mccrea@<hostname>]$ ps aux | grep sensu
sensu 50512 0.0 0.9 127732 38328 ? SNl May11 31:37 /usr/sbin/sensu-agent start

```

The sensu-agent isn’t actually restarting, even though it says “sensu-agent started”. Not actually sure why this happens but at least a _real_ restart of the sensu agent fixed the issue.

---

<div class="post-metadata">

**Author:** ![amccrea](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/amccrea/32/287_2.png) [@amccrea](https://discourse.sensu.io/u/amccrea)\
**Post date:** [June 3, 2020, 7:59pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/9 "2020-06-03T19:59:44Z")

</div>

Thanks for the help anyway! Rubber duck debugging ftw

---

<div class="post-metadata">

**Author:** ![swapzero](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/swapzero/32/529_2.png) [@swapzero](https://discourse.sensu.io/u/swapzero)\
**Post date:** [January 9, 2021, 6:01pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/10 "2021-01-09T18:01:19Z")

</div>

Hi there. I recently ran into this same issue with a bunch of my entities. I started the agent with 3 subscriptions and after creating a check with new subscription (named **zookeeper** ) and adding it to the agent, the new check was not picked up since the backend never recognized the new subscription in the entity. Initially when the agent was installed, the zookeeper subscription didnot exist but after setting up the new check with a new subscription and trying to add the subscription to the agent just didnot seem to pick this up. The timeline was as follows

- Install agent with 3 subscriptions and see it on SensuUI
- Add new check called check-zookeeper with new subscription zookeeper
- Add new subscription to the agent.yml file and restart the sensu-agent with `service sensu-agent restart`
- New subscription and checks not picked up by backend as per sensuctl and SensuUI
- Delete the sensu-agent process and retry again but same failure
- Stop the sensu-agent, wait for 5 minutes and then start again but same failure.

Agent verison:

```auto
[centos@zk-1 ~]$ sensu-agent version
sensu-agent version 6.2.0+ee, enterprise edition, build 62b5a984ace2698a52d590e732767a613b11d0b4, built 2020-12-16T23:33:11Z, built with go1.13.15

```

Agent configuration:

```auto
subscriptions:
  - webserver
  - all
  - system
  - zookeeper

backend-url:
  - "ws://<BACKEND>:8081"

name: "<HOSTNAME>"
namespace: "digital-services"
log-level: "info" # available log levels: panic, fatal, error, warn, info, debug

```

Check info using `sensuctl check list | grep zookeeper` :

```auto
[root@zk-1 centos]# sensuctl check list | grep zookeeper
  check-zookeeper check-process.rb -p zookeeper 60 0 0 zookeeper opsgenie sensu-ruby-runtime,process-plugin true false

```

Entity info using `sensuctl entity info <HOSTNAME>` :

```auto
=== <HOSTNAME>
Name: <HOSTNAME>
Entity Class: agent
Subscriptions: webserver, all, system, entity:<HOSTNAME>
Last Seen: 2021-01-09 17:31:47 +0000 UTC
Hostname: <HOSTNAME>
OS: linux
Platform: centos
Platform Family: rhel
Platform Version: 7.8.2003
Auto-Deregistration: false
Deregistration Handler:

```

Process information:

```auto
[root@zk-1 centos]# ps aux | grep sensu
sensu 8960 0.0 2.0 128564 40904 ? Ssl 17:12 0:00 /usr/sbin/sensu-agent start
root 10910 0.0 0.1 112828 2316 pts/0 S+ 17:34 0:00 grep --color=auto sensu

```

Any idea what went wrong in my approach? If it matters, the backend is running in a cluster mode with 3 instances

---

<div class="post-metadata">

**Author:** ![ceda](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ceda/32/217_2.png) [@ceda](https://discourse.sensu.io/u/ceda)\
**Post date:** [April 27, 2024, 5:02pm UTC](https://discourse.sensu.io/t/sensu-backend-not-picking-up-subscriptions-added-to-a-hosts-agent-yml/1846/12 "2024-04-27T17:02:30Z")

</div>

I learned that agent’s config won’t change in the backend unless you’ve set `agent-managed-entity: true` in the agent’s config.

> [@Modifying agent config requires removing the agent asset](https://discourse.sensu.io/t/modifying-agent-config-requires-removing-the-agent-asset/2766):
>
> Sensu Go 6.6.1 I’ve configured the agents with just the bare minimum config file to connect to the cluster. No subscriptions were defined in the agent configs. But now I want to add more subscriptions to the agents. I’ve edited the agent config files, enabling this, and then I restarted the agents: subscriptions: - http-checks-remote However, if I do that, in sensuctl entity list nothing has changed. The agents do not get the new subscription. If I stop the agent, remove it from the entit…
