Silencing API

The /silenced API endpoint

/silenced (GET)

The /silenced API endpoint provides HTTP GET access to silencing entry data.

EXAMPLE

The following example demonstrates a request to the /silenced API, resulting in a JSON Array containing silencing entry definitions.

curl -H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced

HTTP/1.1 200 OK
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "subscription": "linux",
    "begin": 1542671205
  }
]

API Specification

/silenced (GET)
description Returns the list of silences.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced
pagination This endpoint supports pagination using the limit and continue query parameters. See the API overview for details.
response type Array
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
output
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "subscription": "linux",
    "begin": 1542671205
  }
]

/silenced (POST)

/silenced (POST)
description Create a Sensu silencing entry.
example URL http://hostname:8080/api/core/v2/namespaces/default/silenced
payload
{
  "metadata": {
    "name": "linux:check-cpu",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "expire": -1,
  "expire_on_resolve": false,
  "creator": "admin",
  "subscription": "linux",
  "begin": 1542671205
}
response codes
  • Success: 204 (No Content)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

The /silenced/:silenced API endpoint

/silenced/:silenced (GET)

The /silenced/:silenced API endpoint provides HTTP GET access to silencing entry data for specific :silenced definitions, by silencing entry name.

EXAMPLE

In the following example, querying the /silenced/:silenced API returns a JSON Map containing the requested silencing entry definition (in this example: for the silencing entry named linux:check-cpu). Silencing entry names are generated from the combination of a subscription name and check name.

curl -H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced/linux:check-cpu

HTTP/1.1 200 OK
{
  "metadata": {
    "name": "linux:check-cpu",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "expire": -1,
  "expire_on_resolve": false,
  "creator": "admin",
  "subscription": "linux",
  "begin": 1542671205
}

API Specification

/silenced/:silenced (GET)
description Returns a silencing entry.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/linux:check-cpu
response type Map
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
{
  "metadata": {
    "name": "linux:check-cpu",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "expire": -1,
  "expire_on_resolve": false,
  "creator": "admin",
  "subscription": "linux",
  "begin": 1542671205
}

/silenced/:silenced (PUT)

API Specification

/silenced/:silenced (PUT)
description Create or update a Sensu silencing entry.
example URL http://hostname:8080/api/core/v2/namespaces/default/silenced/linux:check-cpu
payload
{
  "metadata": {
    "name": "linux:check-cpu",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "expire": -1,
  "expire_on_resolve": false,
  "creator": "admin",
  "subscription": "linux",
  "begin": 1542671205
}
response codes
  • Successfully created or updated: 204 (No Content)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/silenced/:silenced (DELETE)

The /silenced/:silenced API endpoint provides HTTP DELETE access to delete a silencing entry by silencing entry name.

EXAMPLE

In the following example, querying the /silenced/:silenced API to delete the the silencing entry named linux:check-cpu results in a successful 204 No Content response.

curl -X DELETE \
-H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced/linux:check-cpu

HTTP/1.1 204 No Content

API Specification

/silenced/:silenced (DELETE)
description Removes a silencing entry from Sensu given the silencing entry name.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/linux:check-cpu
response codes
  • Success: 204 (No Content)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)

The /silenced/subscriptions/:subscription API endpoint

/silenced/subscriptions/:subscription (GET)

The /silenced/subscriptions/:subscription API endpoint provides HTTP GET access to silencing entry data by subscription name.

EXAMPLE

In the following example, querying the silenced/subscriptions/:subscription API returns a JSON Array containing the requested silences for the given subscription (in this example: for the linux subscription).

curl -H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced/subscriptions/linux

HTTP/1.1 200 OK
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "subscription": "linux",
    "begin": 1542671205
  }
]

API Specification

/silenced/ subscriptions/ :subscription (GET)
description Returns all silences for the specified subscription.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/subscriptions/linux
pagination This endpoint supports pagination using the limit and continue query parameters. See the API overview for details.
response type Array
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "subscription": "linux",
    "begin": 1542671205
  }
]

The /silenced/checks/:check API endpoint

/silenced/checks/:check (GET)

The /silenced/checks/:check API endpoint provides HTTP GET access to silencing entry data by check name.

EXAMPLE

In the following example, querying the silenced/checks/:check API returns a JSON Array containing the requested silences for the given check (in this example: for the check-cpu check).

curl -H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced/checks/check-cpu

HTTP/1.1 200 OK
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "check": "linux",
    "begin": 1542671205
  }
]

API Specification

/silenced/checks/ :check (GET)
description Returns all silences for the specified check.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/checks/check-cpu
pagination This endpoint supports pagination using the limit and continue query parameters. See the API overview for details.
response type Array
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
[
  {
    "metadata": {
      "name": "linux:check-cpu",
      "namespace": "default",
      "labels": null,
      "annotations": null
    },
    "expire": -1,
    "expire_on_resolve": false,
    "creator": "admin",
    "check": "linux",
    "begin": 1542671205
  }
]