core/v2/events
PRO TIP: The core/v2/events
API endpoints are primarily designed to provide HTTP access to event data created by agent-executed checks.
To test your Sensu observability pipeline, use the agent API to create new ad hoc events or sensuctl or the web UI to execute existing checks on demand.
NOTE: Requests to core/v2/events
API endpoints require you to authenticate with a Sensu API key or access token.
The code examples in this document use the environment variable $SENSU_API_KEY
to represent a valid API key in API requests.
Get all events
The /events
API endpoint provides HTTP GET access to event data.
Example
The following example demonstrates a request to the /events
API endpoint, resulting in a JSON array that contains event definitions.
curl -X GET \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events \
-H "Authorization: Key $SENSU_API_KEY"
The request results in a successful HTTP/1.1 200 OK
response and a JSON array that contains the event definitions in the default
namespace:
[
{
"check": {
"command": "check-cpu-usage -w 75 -c 90",
"handlers": [],
"high_flap_threshold": 0,
"interval": 60,
"low_flap_threshold": 0,
"publish": true,
"runtime_assets": [
"check-cpu-usage"
],
"subscriptions": [
"system"
],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 0,
"round_robin": false,
"duration": 5.052973881,
"executed": 1620313661,
"history": [
{
"status": 0,
"executed": 1620313601
},
{
"status": 0,
"executed": 1620313661
}
],
"issued": 1620313661,
"output": "CheckCPU TOTAL OK: total=0.2 user=0.2 nice=0.0 system=0.0 idle=99.8 iowait=0.0 irq=0.0 softirq=0.0 steal=0.0 guest=0.0 guest_nice=0.0\n",
"state": "passing",
"status": 0,
"total_state_change": 0,
"last_ok": 1620313661,
"occurrences": 2,
"occurrences_watermark": 2,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "check_cpu",
"namespace": "default"
},
"secrets": null,
"is_silenced": false,
"processed_by": "server1",
"scheduler": "memory"
},
"entity": {
"entity_class": "agent",
"system": {
"hostname": "server1",
"os": "linux",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.5.1804",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "eth0",
"mac": "08:00:27:8b:c9:3f",
"addresses": [
"10.0.2.15/24",
"fe80::bc00:e2c8:1059:3868/64"
]
},
{
"name": "eth1",
"mac": "08:00:27:73:87:93",
"addresses": [
"172.28.128.57/24",
"fe80::a00:27ff:fe73:8793/64"
]
}
]
},
"arch": "amd64",
"libc_type": "glibc",
"vm_system": "vbox",
"vm_role": "guest",
"cloud_provider": "",
"processes": null
},
"subscriptions": [
"system",
"entity:server1"
],
"last_seen": 1620313661,
"deregister": false,
"deregistration": {},
"user": "agent",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"metadata": {
"name": "server1",
"namespace": "default"
},
"sensu_agent_version": "6.2.7"
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
],
"id": "da53be74-be42-4862-a481-b7e3236e8e6d",
"metadata": {
"namespace": "default"
},
"sequence": 3,
"timestamp": 1620313666
}
]
API Specification
/events (GET) | |
---|---|
description | Returns the list of events. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events |
pagination | This endpoint supports pagination using the limit and continue query parameters. |
response filtering | This endpoint supports API response filtering. |
response type | Array |
response codes |
|
output |
|
Create a new event
The /events
API endpoint provides HTTP POST access to create an event and send it to the Sensu observability pipeline.
Example
In the following example, an HTTP POST request is submitted to the /events
API endpoint to create an event.
The request includes information about the check and entity represented by the event:
curl -X POST \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1",
"namespace": "default"
}
},
"check": {
"output": "Server error",
"state": "failing",
"status": 2,
"interval": 60,
"metadata": {
"name": "server-health"
}
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
]
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events
The request will return a successful HTTP/1.1 201 Created
response.
To create useful, actionable events, we recommend using check attributes like status
(0
for OK, 1
for warning, 2
for critical) and output
, as well as adding pipelines
, as shown in this example.
For more information about event attributes and their available values, read the event specification.
For events created with this endpoint, the following attributes have the default value 0
unless you specify a different value for testing:
executed
issued
last_seen
status
The last_ok
attribute will default to 0
even if you manually specify OK status in the request body.
The sensu_agent_version
attribute will return with a null value for events created with this endpoint because these events are not created by an agent-executed check.
API Specification
/events (POST) | |
---|---|
description | Creates a new Sensu event. To update an existing event, use the /events PUT endpoint.If you create a new event that references an entity that does not already exist, sensu-backend will automatically create a proxy entity in the same namespace when the event is published. If you create an event that references an existing entity but includes different information for entity attributes, Sensu will not make any changes to the existing entity’s definition based on the event you create via the API. NOTE: An agent cannot belong to, execute checks in, or create events in more than one namespace. |
example URL | http://hostname:8080/api/core/v2/namespaces/default/events |
payload |
|
response codes |
|
Get event data for a specific entity
The /events/:entity
API endpoint provides HTTP GET access to event data specific to an :entity
, by entity name
.
Example
The following example queries the /events/:entity
API endpoint for Sensu events for the server1
entity:
curl -X GET \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1 \
-H "Authorization: Key $SENSU_API_KEY"
The request will return a successful HTTP/1.1 200 OK
response and a JSON map that contains the Sensu events for the server1
entity:
[
{
"check": {
"command": "check-cpu-usage -w 75 -c 90",
"handlers": [],
"high_flap_threshold": 0,
"interval": 60,
"low_flap_threshold": 0,
"publish": true,
"runtime_assets": [
"check-cpu-usage"
],
"subscriptions": [
"system"
],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 0,
"round_robin": false,
"duration": 5.052973881,
"executed": 1620313661,
"history": [
{
"status": 0,
"executed": 1620313601
},
{
"status": 0,
"executed": 1620313661
}
],
"issued": 1620313661,
"output": "CheckCPU TOTAL OK: total=0.2 user=0.2 nice=0.0 system=0.0 idle=99.8 iowait=0.0 irq=0.0 softirq=0.0 steal=0.0 guest=0.0 guest_nice=0.0\n",
"state": "passing",
"status": 0,
"total_state_change": 0,
"last_ok": 1620313661,
"occurrences": 2,
"occurrences_watermark": 2,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "check_cpu",
"namespace": "default"
},
"secrets": null,
"is_silenced": false,
"processed_by": "server1",
"scheduler": "memory"
},
"entity": {
"entity_class": "agent",
"system": {
"hostname": "server1",
"os": "linux",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.5.1804",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "eth0",
"mac": "08:00:27:8b:c9:3f",
"addresses": [
"10.0.2.15/24",
"fe80::bc00:e2c8:1059:3868/64"
]
},
{
"name": "eth1",
"mac": "08:00:27:73:87:93",
"addresses": [
"172.28.128.57/24",
"fe80::a00:27ff:fe73:8793/64"
]
}
]
},
"arch": "amd64",
"libc_type": "glibc",
"vm_system": "vbox",
"vm_role": "guest",
"cloud_provider": "",
"processes": null
},
"subscriptions": [
"system",
"entity:server1"
],
"last_seen": 1620313661,
"deregister": false,
"deregistration": {},
"user": "agent",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"metadata": {
"name": "server1",
"namespace": "default"
},
"sensu_agent_version": "6.2.7"
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
],
"id": "da53be74-be42-4862-a481-b7e3236e8e6d",
"metadata": {
"namespace": "default"
},
"sequence": 3,
"timestamp": 1620313666
},
{
"check": {
"handlers": [],
"high_flap_threshold": 0,
"interval": 20,
"low_flap_threshold": 0,
"publish": false,
"runtime_assets": null,
"subscriptions": [],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 120,
"round_robin": false,
"executed": 1620313714,
"history": [
{
"status": 0,
"executed": 1620313314
},
{
"status": 0,
"executed": 1620313334
},
{
"status": 0,
"executed": 1620313354
},
{
"...": 0,
"...": 1620313374
}
],
"issued": 1620313714,
"output": "Keepalive last sent from server1 at 2021-05-06 15:08:34 +0000 UTC",
"state": "passing",
"status": 0,
"total_state_change": 0,
"last_ok": 1620313714,
"occurrences": 358,
"occurrences_watermark": 358,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "keepalive",
"namespace": "default"
},
"secrets": null,
"is_silenced": false,
"processed_by": "server1",
"scheduler": "etcd"
},
"entity": {
"entity_class": "agent",
"system": {
"hostname": "server1",
"os": "linux",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.5.1804",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "eth0",
"mac": "08:00:27:8b:c9:3f",
"addresses": [
"10.0.2.15/24",
"fe80::bc00:e2c8:1059:3868/64"
]
},
{
"name": "eth1",
"mac": "08:00:27:73:87:93",
"addresses": [
"172.28.128.57/24",
"fe80::a00:27ff:fe73:8793/64"
]
}
]
},
"arch": "amd64",
"libc_type": "glibc",
"vm_system": "vbox",
"vm_role": "guest",
"cloud_provider": "",
"processes": null
},
"subscriptions": [
"system",
"entity:server1"
],
"last_seen": 1620313714,
"deregister": false,
"deregistration": {},
"user": "agent",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"metadata": {
"name": "server1",
"namespace": "default"
},
"sensu_agent_version": "6.2.7"
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
],
"id": "8717b1dc-47d2-4b73-a259-ee2645cadbf5",
"metadata": {
"namespace": "default"
},
"sequence": 359,
"timestamp": 1620313714
}
]
API Specification
/events/:entity (GET) | |
---|---|
description | Returns a list of events for the specified entity. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events/server1 |
pagination | This endpoint supports pagination using the limit and continue query parameters. |
response type | Array |
response codes |
|
output |
|
Get event data for a specific entity and check
The /events/:entity/:check
API endpoint provides HTTP GET access to event data for the specified entity and check.
Example
In the following example, an HTTP GET request is submitted to the /events/:entity/:check
API endpoint to retrieve the event for the server1
entity and the check_cpu
check:
curl -X GET \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/check_cpu \
-H "Authorization: Key $SENSU_API_KEY"
The request will return a successful HTTP/1.1 200 OK
response and a JSON map that contains the Sensu events for the server1
entity and check_cpu
check:
{
"check": {
"command": "check-cpu-usage -w 75 -c 90",
"handlers": [],
"high_flap_threshold": 0,
"interval": 60,
"low_flap_threshold": 0,
"publish": true,
"runtime_assets": [
"check-cpu-usage"
],
"subscriptions": [
"system"
],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 0,
"round_robin": false,
"duration": 5.050929017,
"executed": 1620313539,
"history": null,
"issued": 1620313539,
"output": "CheckCPU TOTAL OK: total=2.85 user=2.65 nice=0.0 system=0.2 idle=97.15 iowait=0.0 irq=0.0 softirq=0.0 steal=0.0 guest=0.0 guest_nice=0.0\n",
"state": "passing",
"status": 0,
"total_state_change": 0,
"last_ok": 1620313539,
"occurrences": 1,
"occurrences_watermark": 1,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "check_cpu",
"namespace": "default"
},
"secrets": null,
"is_silenced": false,
"processed_by": "server1",
"scheduler": ""
},
"entity": {
"entity_class": "agent",
"system": {
"hostname": "server1",
"os": "linux",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.5.1804",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "eth0",
"mac": "08:00:27:8b:c9:3f",
"addresses": [
"10.0.2.15/24",
"fe80::bc00:e2c8:1059:3868/64"
]
},
{
"name": "eth1",
"mac": "08:00:27:73:87:93",
"addresses": [
"172.28.128.57/24",
"fe80::a00:27ff:fe73:8793/64"
]
}
]
},
"arch": "amd64",
"libc_type": "glibc",
"vm_system": "vbox",
"vm_role": "guest",
"cloud_provider": "",
"processes": null
},
"subscriptions": [
"system",
"entity:server1"
],
"last_seen": 1620313539,
"deregister": false,
"deregistration": {},
"user": "agent",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"metadata": {
"name": "server1",
"namespace": "default"
},
"sensu_agent_version": "6.2.7"
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
],
"id": "9a9c7515-0a04-43f3-9351-d8da88942b1b",
"metadata": {
"namespace": "default"
},
"sequence": 1,
"timestamp": 1620313546
}
API Specification
/events/:entity/:check (GET) | |
---|---|
description | Returns an event for the specified entity and check. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events/server1/check_cpu |
response type | Map |
response codes |
|
output |
|
Create a new event for an entity and check
The /events/:entity/:check
API endpoint provides HTTP POST access to create an event and send it to the Sensu observability pipeline.
Example
In the following example, an HTTP POST request is submitted to the /events/:entity/:check
API endpoint to create an event for the server1
entity and the server-health
check and process it using the incident_alerts
pipeline.
The event includes a status code of 1
, indicating a warning, and an output message of Server error
.
curl -X POST \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1",
"namespace": "default"
}
},
"check": {
"output": "Server error",
"status": 1,
"interval": 60,
"metadata": {
"name": "server-health"
}
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
]
} \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/server-health
The request will return a successful HTTP/1.1 201 Created
response.
NOTE: A namespace is not required to create the event. The event will use the namespace in the URL by default.
You can use sensuctl or the Sensu web UI to view the event:
sensuctl event list
The response should list the event with the status and output specified in the request:
Entity Check Output Status Silenced Timestamp
────────────── ───────────── ─────────────────────────────────── ──────── ────────── ───────────────────────────────
server1 server-health Server error 1 false 2019-03-14 16:56:09 +0000 UTC
For events created with this endpoint, the following attributes have the default value 0
unless you specify a different value for testing:
executed
issued
last_seen
status
The last_ok
attribute will default to 0
even if you manually specify OK status in the request body.
The sensu_agent_version
attribute will return with a null value for events created with this endpoint because these events are not created by an agent-executed check.
API Specification
/events/:entity/:check (POST) | |
---|---|
description | Creates an event for the specified entity and check. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events/server1/server-health |
payload |
|
response codes |
|
Create or update an event for an entity and check
The /events/:entity/:check
API endpoint provides HTTP PUT access to create or update an event and send it to the Sensu observability pipeline.
Example
In the following example, an HTTP PUT request is submitted to the /events/:entity/:check
API endpoint to create an event for the server1
entity and the server-health
check and process it using the incident_alerts
pipeline.
The event includes a status code of 1
, indicating a warning, and an output message of Server error
.
curl -X PUT \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1",
"namespace": "default"
}
},
"check": {
"output": "Server error",
"status": 1,
"interval": 60,
"metadata": {
"name": "server-health"
}
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
]
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/server-health
The request will return a successful HTTP/1.1 201 Created
response.
NOTE: A namespace is not required to create the event. The event will use the namespace in the URL by default.
You can use sensuctl or the Sensu web UI to view the event:
sensuctl event list
The response should list the event with the status and output specified in the request:
Entity Check Output Status Silenced Timestamp
────────────── ───────────── ─────────────────────────────────── ──────── ────────── ───────────────────────────────
server1 server-health Server error 1 false 2019-03-14 16:56:09 +0000 UTC
API Specification
/events/:entity/:check (PUT) | |
---|---|
description | Creates an event for the specified entity and check. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events/server1/server-health |
payload |
|
payload parameters | Review the payload parameters section below. |
response codes |
|
Payload parameters
The /events/:entity/:check
PUT endpoint requires a request payload that contains an entity
scope and a check
scope.
- The
entity
scope contains information about the component of your infrastructure represented by the event. At minimum, Sensu requires theentity
scope to contain theentity_class
(agent
orproxy
) and the entityname
andnamespace
within ametadata
scope. For more information about entity attributes, review the entity specification. - The
check
scope contains information about the event status and how the event was created. At minimum, Sensu requires thecheck
scope to contain aname
within ametadata
scope and either aninterval
orcron
attribute. For more information about check attributes, review the check specification.
Example request with minimum required event attributes
curl -X PUT \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1"
}
},
"check": {
"interval": 60,
"metadata": {
"name": "server-health"
}
}
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/server-health
The request will return a successful HTTP/1.1 201 Created
response.
The minimum required attributes let you create an event using the /events/:entity/:check
PUT endpoint, but the request can include any attributes defined in the event specification.
To create useful, actionable events, we recommend adding check attributes such as the event status
(0
for OK, 1
for warning, 2
for critical), an output
message, and one or more pipelines
.
For more information about these attributes and their available values, review the event specification.
Example request with minimum recommended event attributes
curl -X PUT \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1",
"namespace": "default"
}
},
"check": {
"output": "Server error",
"status": 1,
"interval": 60,
"metadata": {
"name": "server-health"
}
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "incident_alerts"
}
]
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/server-health
The request will return a successful HTTP/1.1 201 Created
response.
Create metrics events
In addition to the entity
and check
scopes, Sensu events can include a metrics
scope that contains metrics in Sensu metric format.
Read the events reference and for more information about Sensu metric format.
Example request including metrics
curl -X PUT \
-H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"entity": {
"entity_class": "proxy",
"metadata": {
"name": "server1",
"namespace": "default"
}
},
"check": {
"status": 0,
"output_metric_handlers": ["influxdb"],
"interval": 60,
"metadata": {
"name": "server-metrics"
}
},
"metrics": {
"handlers": [
"influxdb"
],
"points": [
{
"name": "server1.server-metrics.time_total",
"tags": [],
"timestamp": 1552506033,
"value": 0.005
},
{
"name": "server1.server-metrics.time_namelookup",
"tags": [],
"timestamp": 1552506033,
"value": 0.004
}
]
},
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "metrics_workflows"
}
]
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/server-metrics
The request will return a successful HTTP/1.1 201 Created
response.
Delete an event
Example
The following example shows a request to the /events/:entity/:check
API endpoint to delete the event produced by the server1
entity and check_cpu
check, resulting in a successful HTTP/1.1 204 No Content
response.
curl -X DELETE \
http://127.0.0.1:8080/api/core/v2/namespaces/default/events/server1/check_cpu \
-H "Authorization: Key $SENSU_API_KEY"
API Specification
/events/:entity/:check (DELETE) | |
---|---|
description | Deletes the event created by the specified entity using the specified check. |
example url | http://hostname:8080/api/core/v2/namespaces/default/events/server1/check_cpu |
response codes |
|
Get a subset of events with response filtering
The /events
API endpoint supports response filtering for a subset of event data based on labels and the following fields:
event.name
event.namespace
event.is_silenced
event.check.handlers
event.check.is_silenced
event.check.name
event.check.publish
event.check.round_robin
event.check.runtime_assets
event.check.status
event.check.subscriptions
event.entity.deregister
event.entity.entity_class
event.entity.name
event.entity.subscriptions
Example
The following example demonstrates a request to the /events
API endpoint with response filtering for events from entities whose subscriptions include linux
:
curl -H "Authorization: Key $SENSU_API_KEY" http://127.0.0.1:8080/api/core/v2/events -G \
--data-urlencode 'fieldSelector="linux" in event.entity.subscriptions'
The example request will result in a successful HTTP/1.1 200 OK
response and a JSON array that contains only event definitions for entities whose subscriptions include linux
:
[
{
"timestamp": 1644848031,
"entity": {
"entity_class": "agent",
"system": {
"hostname": "sensu-centos",
"os": "linux",
"platform": "centos",
"platform_family": "rhel",
"platform_version": "7.5.1804",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "eth0",
"mac": "08:00:27:8b:c9:3f",
"addresses": [
"10.0.2.15/24",
"fe80::c68e:8fd8:32f0:7c5d/64"
]
},
{
"name": "eth1",
"mac": "08:00:27:3b:a9:9f",
"addresses": [
"192.168.56.23/24",
"fe80::a00:27ff:fe3b:a99f/64"
]
}
]
},
"arch": "amd64",
"libc_type": "glibc",
"vm_system": "vbox",
"vm_role": "guest",
"cloud_provider": "",
"processes": null
},
"subscriptions": [
"linux",
"entity:sensu-centos",
"system"
],
"last_seen": 1644848029,
"deregister": false,
"deregistration": {},
"user": "agent",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"metadata": {
"name": "sensu-centos",
"namespace": "default",
"created_by": "admin"
},
"sensu_agent_version": "6.6.5"
},
"check": {
"command": "check-cpu-usage -w 1 -c 2",
"handlers": [],
"high_flap_threshold": 0,
"interval": 15,
"low_flap_threshold": 0,
"publish": true,
"runtime_assets": [
"check-cpu-usage"
],
"subscriptions": [
"system"
],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 0,
"round_robin": false,
"duration": 2.010462294,
"executed": 1644848029,
"history": [
{
"status": 2,
"executed": 1644847740
},
{
"status": 1,
"executed": 1644847755
},
{
"status": 1,
"executed": 1644847770
},
{
"status": 2,
"executed": 1644847785
},
{
"status": 2,
"executed": 1644847800
},
{
"status": 1,
"executed": 1644847815
},
{
"status": 2,
"executed": 1644847830
},
{
"status": 1,
"executed": 1644847845
},
{
"status": 1,
"executed": 1644847860
},
{
"status": 1,
"executed": 1644847875
},
{
"status": 1,
"executed": 1644847890
},
{
"status": 0,
"executed": 1644847905
},
{
"status": 2,
"executed": 1644847920
},
{
"status": 1,
"executed": 1644847935
},
{
"status": 0,
"executed": 1644847950
},
{
"status": 0,
"executed": 1644847965
},
{
"status": 2,
"executed": 1644847980
},
{
"status": 2,
"executed": 1644847995
},
{
"status": 1,
"executed": 1644848010
},
{
"status": 1,
"executed": 1644848014
},
{
"status": 0,
"executed": 1644848029
}
],
"issued": 1644848029,
"output": "check-cpu-usage OK: 0.51% CPU usage | cpu_idle=99.49, cpu_system=0.51, cpu_user=0.00, cpu_nice=0.00, cpu_iowait=0.00, cpu_irq=0.00, cpu_softirq=0.00, cpu_steal=0.00, cpu_guest=0.00, cpu_guestnice=0.00\n",
"state": "passing",
"status": 0,
"total_state_change": 59,
"last_ok": 1644848029,
"occurrences": 1,
"occurrences_watermark": 2,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "check_cpu",
"namespace": "default"
},
"secrets": null,
"is_silenced": false,
"scheduler": "memory",
"processed_by": "sensu-centos",
"pipelines": []
},
"metadata": {
"namespace": "default"
},
"id": "f5ef6190-a8e2-4660-9ad1-02ae0a2e89f4",
"sequence": 2,
"pipelines": [
{
"api_version": "core/v2",
"type": "Pipeline",
"name": "metrics_workflows"
}
]
}
]
NOTE: Read API response filtering for more filter statement examples that demonstrate how to filter responses using different operators with label and field selectors.
API Specification
/events (GET) with response filters | |
---|---|
description | Returns the list of events that match the response filters applied in the API request. |
example url | http://hostname:8080/api/core/v2/events |
pagination | This endpoint supports pagination using the limit and continue query parameters. |
response type | Array |
response codes |
|
output |
|