devices
Creates, updates, deletes, gets or lists a devices resource.
Overview
| Name | devices |
| Type | Resource |
| Id | datadog.infrastructure.devices |
Fields
The following fields are returned by SELECT queries:
- get_device
- list_devices
| Name | Datatype | Description |
|---|---|---|
id | string | The device ID (example: example:1.2.3.4) |
attributes | object | The device attributes |
type | string | The type of the resource. The value should always be device. |
| Name | Datatype | Description |
|---|---|---|
id | string | The device ID (example: example:1.2.3.4) |
attributes | object | The device attributes |
type | string | The type of the resource. The value should always be device. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_device | select | device_id | Get the device details. | |
list_devices | select | page[size], page[number], sort, filter[tag] | Get the list of devices. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
device_id | string | The id of the device to fetch. (example: example:1.2.3.4) |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
filter[tag] | string | Filter devices by tag. (example: status:ok) |
page[number] | integer (int64) | Specific page number to return. Defaults to 0. |
page[size] | integer (int64) | Size for a given page. The maximum allowed value is 500. Defaults to 50. |
sort | string | The field to sort the devices by. Defaults to name. (example: status) |
SELECT examples
- get_device
- list_devices
Get the device details.
SELECT
id,
attributes,
type
FROM datadog.infrastructure.devices
WHERE device_id = '{{ device_id }}' -- required
;
Get the list of devices.
SELECT
id,
attributes,
type
FROM datadog.infrastructure.devices
WHERE page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND sort = '{{ sort }}'
AND filter[tag] = '{{ filter[tag] }}'
;