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

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?

Do the additional new subscriptions have any checks defined for them yet?

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/

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.

Interesting. The only time I see a similar issue is when I add an entity to a subscription that does not yet have any checks associated with it and once checks are added that subscription shows up for the entity.

Would it be possible for you to post relevant portions of your agent.yml (just the metadata like name and subscriptions), the output of sensuctl entity info <entity_name> , and maybe the output of sensuctl check list | grep <subscription in question>?

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
- wss://<sensu_backend>:8081
- 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

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.

1 Like

Good to know, because that behavior was quite puzzling otherwise.

Thanks for the help anyway! Rubber duck debugging ftw

1 Like