Removing a subscription from an entity/agent then re-adding that subscription to the agent and the checks for that subscription do not run. My problem exists with proxied checks/entities, I've not tested with non-proxied.
When re-adding a previously removed subscription, the checks should start running again and creating events.
Checks are not running on their intervals. Checks can be manually initiated from the dashboard or via sensuctl.
# cat true.json
{
"type": "CheckConfig",
"spec": {
"command": "/bin/true",
"handlers": [ "mail" ],
"interval": 60,
"timeout": 0,
"subscriptions": [
"truth-proxied"
],
"proxy_entity_name": "source-of-truth",
"publish": true,
"metadata": {
"name": "check-for-truth",
"namespace": "AWS"
}
}
}
# sensuctl create -f true.json
# sensuctl check info check-for-truth --format wrapped-json
{
"type": "CheckConfig",
"api_version": "core/v2",
"metadata": {
"name": "check-for-truth",
"namespace": "AWS"
},
"spec": {
"check_hooks": null,
"command": "/bin/true",
"env_vars": null,
"handlers": [
"mail"
],
"high_flap_threshold": 0,
"interval": 60,
"low_flap_threshold": 0,
"output_metric_format": "",
"output_metric_handlers": null,
"proxy_entity_name": "source-of-truth",
"publish": true,
"round_robin": false,
"runtime_assets": null,
"stdin": false,
"subdue": null,
"subscriptions": [
"truth-proxied"
],
"timeout": 0,
"ttl": 0
}
}
# sensuctl entity info example1.aws.example.com
=== example1.aws.example.com
Name: example1.aws.example.com
Entity Class: agent
Subscriptions: linux, truth-proxied, entity:example1.aws.example.com
Last Seen: 2019-01-11 09:56:16 -0800 PST
Hostname: example1.aws.example.com
OS: linux
Platform: ubuntu
Platform Family: debian
Platform Version: 16.04
Auto-Deregistration: false
Deregistration Handler:
# sensuctl entity info source-of-truth
=== source-of-truth
Name: source-of-truth
Entity Class: proxy
Subscriptions: entity:source-of-truth
Last Seen: N/A
Hostname:
OS:
Platform:
Platform Family:
Platform Version:
Auto-Deregistration: false
Deregistration Handler:
# sensuctl event info source-of-truth check-for-truth
=== source-of-truth - check-for-truth
Entity: source-of-truth
Check: check-for-truth
Output:
Status: 0
History: 0,0,0,0,0,0
Silenced: false
Timestamp: 2019-01-11 10:03:16 -0800 PST
=================================================
Remove subscription from client/agent and restart
=================================================
# sensuctl entity info example1.aws.example.com
=== example1.aws.example.com
Name: example1.aws.example.com
Entity Class: agent
Subscriptions: linux, entity:example1.aws.example.com
Last Seen: 2019-01-11 10:04:19 -0800 PST
Hostname: example1.aws.example.com
OS: linux
Platform: ubuntu
Platform Family: debian
Platform Version: 16.04
Auto-Deregistration: false
Deregistration Handler:
# sensuctl event info source-of-truth check-for-truth
=== source-of-truth - check-for-truth
Entity: source-of-truth
Check: check-for-truth
Output:
Status: 0
History: 0,0,0,0,0,0,0
Silenced: false
Timestamp: 2019-01-11 10:04:16 -0800 PST
=================================================
Wait several minutes, timestamp has not changed
=================================================
# sensuctl event info source-of-truth check-for-truth
=== source-of-truth - check-for-truth
Entity: source-of-truth
Check: check-for-truth
Output:
Status: 0
History: 0,0,0,0,0,0,0
Silenced: false
Timestamp: 2019-01-11 10:04:16 -0800 PST
Only once I deleted the proxied entities, events, and deleted and recreated the checks and then restarted the agent on the client, it started working again.
@nikkiki To review and see if any recent changes changed this behavior.
I'll reevaluate this issue after https://github.com/sensu/sensu-go/pull/2703 lands.
Hey @nixwiz, I've tried to reproduce this issue in a few different environments.
truth-proxiedtruth-proxied subscriptionNeither scenario has allowed me to reproduce the behavior you are describing. I am able to toggle the truth-proxied subscription in an agent config, and the check is run and event is published when the subscription is in the config, and it does not run/get published when the subscription is not in the config.
Have you been able to reproduce this issue since the original incident? Have you been able to reproduce this issue on 5.2.1? If you are able to reproduce, could you attach any backend/agent debug logs?
Any additional information would be helpful so I can track down this bug for you 馃槃
@nikkiki I will give it a shot with 5.2 over the next couple of days.
@nikkiki I just tested this with the brand spanking new 5.2.1 this morning and it appears to be fixed. Woot!
However, during my testing it brought up an interesting question for me. How to deregister proxy entities, especially those created by subscribing to a proxy check (e.g. not created with 'sensuctl create').
After I completed the above testing, I edited the proxy entity and set deregister to true. I then removed the subscription from the entity that subscribed to the proxy check. However the entity still remains. Is that expected? Am I missing something for how to deregister proxy entities?
@nixwiz So glad you're not experiencing the issue any more! That's a great question, but in order to answer that, we need to understand how proxy entities differ from agent entities. The main difference in this case being Keepalives. An ephemeral agent entity (entity-class=agent, deregister=true) will be removed when a failing keepalive is observed. Since proxy entities do not have a keepalive mechanism, they cannot be ephemeral. You can manually delete the proxy entity (or agent entity) if it is no longer relevant to any checks/subscriptions. From my understanding, this is at parity with 1.x behavior.
I'm going to close out this issue, but feel free to open a feature request, or chat in the community slack!