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 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 silencing entries.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced
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: 200 (OK)
  • 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 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
  • Success: 201 (Created)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/silenced/:silenced (DELETE)

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: 202 (Accepted)
  • 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 silencing entries for the given subscription (in this example: for the linux subscription).

curl -H "Authorization: Bearer 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 silencing entries for the specified subscription.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/subscriptions/linux
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 silencing entries for the given check (in this example: for the check-cpu check).

curl -H "Authorization: Bearer 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 silencing entries for the specified check.
example url http://hostname:8080/api/core/v2/namespaces/default/silenced/checks/check-cpu
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
  }
]