# Subscriptions through agent api

**URL:** <https://discourse.sensu.io/t/subscriptions-through-agent-api/2757>\
**Category:** Sensu Go\
**Created:** [November 29, 2021, 9:30pm UTC](https://discourse.sensu.io/t/subscriptions-through-agent-api/2757 "2021-11-29T21:30:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [November 29, 2021, 9:30pm UTC](https://discourse.sensu.io/t/subscriptions-through-agent-api/2757/1 "2021-11-29T21:30:45Z")

</div>

So I can create events with the agent api by posting a json string to local host \<\<sample.file\>\>

[event.json](https://discourse.sensu.io/uploads/short-url/k91cMl1w2HpH0Hhn80FKdlThJEg.json) (439 Bytes)

reading the agent reference I can see mention of subscriptions but only as environment variables, I would like to run a script “on the agent” to modify its subscriptions, something like

if service clussvc = running, add subscription windows/cluster

is that possible on the agent or do i need to go to the backend api for that ?

Many thanks  
Andrew

---

<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:** [November 30, 2021, 2:43pm UTC](https://discourse.sensu.io/t/subscriptions-through-agent-api/2757/2 "2021-11-30T14:43:01Z")

</div>

Heyo @ohhfine . As I’m modeling your question, I think this depends entirely on your approach to entity configuration. Are the configurations managed through the agent (i.e., by setting `agent-managed-entity: true` in `agent.yml`) or is the config managed through the API? IMO the approach that _might_ be the most useful would be to ensure that the config is agent-managed and then have some sort of config management agent do the lifting of 1. Ensuring that `agent.yml` has `agent-managed-entity: true` in it and then having the same config management agent adjust the subscription if you know that it’s enforcing that a certain service is running.

---

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [December 1, 2021, 3:20pm UTC](https://discourse.sensu.io/t/subscriptions-through-agent-api/2757/3 "2021-12-01T15:20:22Z")

</div>

I don’t see “agent-managed-entity” in our agent.yaml file at all, the yaml is all preconfigured and deployed with salt, actually in our Linux world everything is heavily automated through salt, windows world, not so much, huge, noisy SCOM setup but working twards using sensu when not needing scom and was wondering if I could do some sort of discovery
