Querying Sensu API for a specific client + check (built-in silencing)

However when using the new built-in silencing, i seem to be only able to query for a specific client (e.g. curl -u admin http://sensu-api:4567/silenced/subscriptions/client:client-name) or a specific check (e.g. curl -u admin http://sensu-api:4567/silenced/checks/check-name) but it does not “seem” to support a combination like we did with stashes.

Is there a way to run the above query using a single curl/URL, or would I need to run one API query and then use the results of that as input to the 2nd query?

When using Sensu stashes, we could query silence stashes for a specific client with a specific check (e.g. curl -u admin http://sensu-api:4567/stashes/silence/client-name/check-name).

Hi Alex,

Under the new silencing paradigm the intersection of subscription and check name is referred to as the identity (ID) of the silencing entry, e.g. “client:i-424242:check_ntp” would be the ID for an entry which silences “check_ntp” on client “i-424242”.

I think you’re correct in asserting that there’s currently no way to directly retrieve a single silencing entry matching a specific ID. It is possible to retrieve a list of all silencing entries and locate a specific client + check combination by ID but this is not optimal in situations where the list of entries is long enough to require pagination.

I believe that querying specific silencing entries by their ID is something it may be reasonable to add in a future release; I’ve opened Silencing API should support retrieving specific entries via ID · Issue #1465 · sensu/sensu · GitHub to propose that.

Cameron

···

On Tuesday, October 11, 2016 at 8:20:58 AM UTC-6, Alex Rodrigues wrote:

When using Sensu stashes, we could query silence stashes for a specific client with a specific check (e.g. curl -u admin http://sensu-api:4567/stashes/silence/client-name/check-name).

However when using the new built-in silencing, i seem to be only able to query for a specific client (e.g. curl -u admin http://sensu-api:4567/silenced/subscriptions/client:client-name) or a specific check (e.g. curl -u admin http://sensu-api:4567/silenced/checks/check-name) but it does not “seem” to support a combination like we did with stashes.

Is there a way to run the above query using a single curl/URL, or would I need to run one API query and then use the results of that as input to the 2nd query?

Thank you Cameron for submitting the proposal!

···

On Wednesday, October 12, 2016 at 10:26:23 AM UTC-4, Cameron Johnston wrote:

Hi Alex,

Under the new silencing paradigm the intersection of subscription and check name is referred to as the identity (ID) of the silencing entry, e.g. “client:i-424242:check_ntp” would be the ID for an entry which silences “check_ntp” on client “i-424242”.

I think you’re correct in asserting that there’s currently no way to directly retrieve a single silencing entry matching a specific ID. It is possible to retrieve a list of all silencing entries and locate a specific client + check combination by ID but this is not optimal in situations where the list of entries is long enough to require pagination.

I believe that querying specific silencing entries by their ID is something it may be reasonable to add in a future release; I’ve opened https://github.com/sensu/sensu/issues/1465 to propose that.

Cameron

On Tuesday, October 11, 2016 at 8:20:58 AM UTC-6, Alex Rodrigues wrote:

When using Sensu stashes, we could query silence stashes for a specific client with a specific check (e.g. curl -u admin http://sensu-api:4567/stashes/silence/client-name/check-name).

However when using the new built-in silencing, i seem to be only able to query for a specific client (e.g. curl -u admin http://sensu-api:4567/silenced/subscriptions/client:client-name) or a specific check (e.g. curl -u admin http://sensu-api:4567/silenced/checks/check-name) but it does not “seem” to support a combination like we did with stashes.

Is there a way to run the above query using a single curl/URL, or would I need to run one API query and then use the results of that as input to the 2nd query?