Hosts API - GET all hosts

We have a new version of this API—Entity API v2. Check it out!

Gets the list of all hosts in your Dynatrace environment, along with their parameters.

The full list can be lengthy, so you can narrow it down by specifying filter parameters, like tags. See the Parameters section for more details.

You can additionally limit the output by using the pagination:

  1. Specify the number of results per page in the pageSize query parameter.
  2. Then use the cursor from the Next-Page-Key response header in the nextPageKey query parameter to obtain subsequent pages.

The request produces an application/json payload.

GET
  • Managed https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts

Authentication

To execute this request, you need the Access problem and event feed, metrics, and topology (DataExport) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.

Parameters

The timeframe is restricted to a maximum period of 3 days.

Parameter Type Description In Required
startTimestamp integer

The start timestamp of the requested timeframe, in milliseconds (UTC).

If not set, then 72 hours behind from now is used.

query optional
endTimestamp integer

The end timestamp of the requested timeframe, in milliseconds (UTC).

If not set, then the current timestamp is used.

The timeframe must not exceed 3 days.

query optional
relativeTime string

The relative timeframe, back from now.

query optional
tag array

Filters the resulting set of hosts by the specified tag. You can specify several tags in the following format: tag=tag1&tag=tag2. The host has to match all the specified tags.

In case of key-value tags, such as imported AWS or CloudFoundry tags, use the following format: tag=[context]key:value. For custom key-value tags, omit the context: tag=key:value.

query optional
showMonitoringCandidates boolean

Includes (true) or excludes (false) a monitoring candidate in the response.

Monitoring candidates are network entities that are detected but not monitored.

query optional
entity array

Filters result to the specified hosts only.

To specify several hosts use the following format: entity=ID1&entity=ID2.

query optional
managementZone integer

Only return hosts that are part of the specified management zone.

query optional
hostGroupId string

Filters the resulting set of hosts by the specified host group.

Specify the Dynatrace IDs of the host group you're interested in.

query optional
hostGroupName string

Filters the resulting set of hosts by the specified host group.

Specify the name of the host group you're interested in.

query optional
includeDetails boolean

Includes (true) or excludes (false) details which are queried from related entities.

Excluding details may make queries faster.

If not set, then true is used.

query optional
pageSize integer

The number of hosts per result page.

If not set, pagination is not used and the result contains all hosts fitting the specified filtering criteria.

query optional
nextPageKey string

The cursor for the next page of results. You can find it in the Next-Page-Key header of the previous response.

If you're using pagination, the first page is always returned without this cursor.

You must keep all other query parameters as they were in the first request to obtain subsequent pages.

query optional

Response

Response codes

Code Description
200

Success

400

Failed. The input is invalid.

Response body

The Host object

Information about the host.

Element Type Description
entityId string

The Dynatrace entity ID of the required entity.

displayName string

The name of the Dynatrace entity as displayed in the UI.

customizedName string

The customized name of the entity

discoveredName string

The discovered name of the entity

firstSeenTimestamp integer

The timestamp of when the entity was first detected, in UTC milliseconds

lastSeenTimestamp integer

The timestamp of when the entity was last detected, in UTC milliseconds

tags TagInfo[]

The list of entity tags.

toRelationships object
gcePublicIpAddresses string[]

The public IP addresses of the Google Compute Engine.

hostGroup HostGroup
gceMachineType string

The Google Compute Engine machine type.

gceProject string

The Google Compute Engine project.

kubernetesCluster string

The kubernetes cluster the entity is in.

cloudPlatformVendorVersion string

Defines the cloud platform vendor version.

autoScalingGroup string
esxiHostName string
osArchitecture string
gceProjectId string

The Google Compute Engine numeric project ID.

openStackInstaceType string
gceInstanceName string

The Google Compute Engine instance name.

hypervisorType string
awsInstanceId string
openstackAvZone string
azureHostNames string[]
ipAddresses string[]
monitoringMode string
amiId string
boshInstanceId string

The Cloud Foundry BOSH instance ID.

boshAvailabilityZone string

The Cloud Foundry BOSH availability zone.

gcpZone string

The Google Cloud Platform Zone.

zosTotalGeneralPurposeProcessors integer

Number of assigned processors for this LPAR.

localHostName string
logicalCpuCores integer
awsSecurityGroup string[]
userLevel string
zosTotalPhysicalMemory integer

Memory assigned to the host (Terabyte).

azureSiteNames string[]
paasAgentVersions AgentVersion[]

The versions of the PaaS agents currently running on the entity.

softwareTechnologies TechnologyInfo[]
boshName string

The Cloud Foundry BOSH name.

simultaneousMultithreading integer

The AIX instance simultaneous threads count.

oneAgentCustomHostName string

The custom name defined in OneAgent config.

openstackProjectName string
isMonitoringCandidate boolean
boshDeploymentId string

The Cloud Foundry BOSH deployment ID.

publicHostName string
boshStemcellVersion string

The Cloud Foundry BOSH stemcell version.

localIp string
consumedHostUnits string
gceInstanceId string

The Google Compute Engine instance ID.

awsNameTag string

The name inherited from AWS.

paasMemoryLimit integer
scaleSetName string
cloudType string
azureVmName string
openstackVmName string
agentVersion AgentVersion
zosCPUModelNumber string

The CPU model number.

kubernetesLabels object

The kubernetes labels defined on the entity.

paasType string
zosTotalZiipProcessors integer

Number of assigned support processors for this LPAR.

boshInstanceName string

The Cloud Foundry BOSH instance name.

publicIp string
azureComputeModeName string
zosVirtualization string

Type of virtualization on the mainframe.

networkZoneId string

The ID of network zone the entity is in.

azureSku string
openstackComputeNodeName string
managementZones EntityShortRepresentation[]

The management zones that the entity is part of.

beanstalkEnvironmentName string
awsInstanceType string
logicalCpus integer

The AIX instance logical CPU count.

zosCPUSerialNumber string

The CPU serial number.

osType string
osVersion string
vmwareName string
kubernetesNode string

The kubernetes node the entity is in.

cpuCores integer
virtualCpus integer

The AIX instance virtual CPU count.

bitness string
openstackSecurityGroups string[]
fromRelationships object

The EntityShortRepresentation object

The short representation of a Dynatrace entity.

Element Type Description
id string

The ID of the Dynatrace entity.

name string

The name of the Dynatrace entity.

description string

A short description of the Dynatrace entity.

The TechnologyInfo object

Element Type Description
type string
edition string
version string

The AgentVersion object

Defines the version of the agent currently running on the entity.

Element Type Description
major integer

The major version number.

minor integer

The minor version number.

revision integer

The revision number.

timestamp string

A timestamp string: format "yyyymmdd-hhmmss

sourceRevision string

A string representation of the SVN revision number.

The HostGroup object

Element Type Description
meId string

The Dynatrace entity ID of the host group.

name string

The name of the Dynatrace entity, displayed in the UI.

The TagInfo object

Tag of a Dynatrace entity.

Element Type Description
context string

The origin of the tag, such as AWS or Cloud Foundry.

Custom tags use the CONTEXTLESS value.

key string

The key of the tag.

Custom tags have the tag value here.

value string

The value of the tag.

Not applicable to custom tags.

Response headers

Header Type Description
Total-Count integer The estimated number of results.
Next-Page-Key string The cursor for the next page of results. Without it you'll get the first page again.
Page-Size string The maximum number of results per page.

Example

In this example, the request lists all hosts in the environment.

The API token is passed in the Authorization header.

The result is truncated to two entries.

Curl

curl -X GET \
  https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts \
  -H 'Authorization: Api-Token abcdefjhij1234567890'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts

Response body

[
  {
    "entityId": "HOST-B7A6F9EE9F366CB5",
    "displayName": "tag009",
    "discoveredName": "tag009",
    "firstSeenTimestamp": 1538473087608,
    "lastSeenTimestamp": 1538641647769,
    "tags": [
      {
        "context": "CONTEXTLESS",
        "key": "loadtest"
      },
      {
        "context": "CONTEXTLESS",
        "key": "host tag"
      }
    ],
    "fromRelationships": {
      "isNetworkClientOfHost": [
        "HOST-80FF8584D8954C1D",
        "HOST-A281F848361E79A1"
      ]
    },
    "toRelationships": {
      "isProcessOf": [
        "PROCESS_GROUP_INSTANCE-9146FB8A6A155F93"
      ],
      "isSiteOf": [
        "GEOLOC_SITE-F72DF471AE5F56F6"
      ],
      "isNetworkClientOfHost": [
        "HOST-80FF8584D8954C1D"
      ],
      "runsOn": [
        "PROCESS_GROUP-83D74C22E79B074F"
      ]
    },
    "osType": "LINUX",
    "osArchitecture": "X86",
    "osVersion": "Ubuntu 18.04.1",
    "ipAddresses": [
      "127.0.0.1",
      "192.168.1.1"
    ],
    "bitness": "64bit",
    "cpuCores": 4,
    "logicalCpuCores": 8,
    "consumedHostUnits": 2,
    "managementZones": [
      {
        "id": "6164525246045854296",
        "name": "Zone Service E"
      },
      {
        "id": "5678",
        "name": "Infrastructure Linux"
      }
    ]
  },
  {
    "entityId": "HOST-2540A456786EEBCA",
    "displayName": "RD40",
    "discoveredName": "RD40",
    "firstSeenTimestamp": 1536455342329,
    "lastSeenTimestamp": 1538661752404,
    "tags": [
      {
        "context": "CONTEXTLESS",
        "key": "loadtest"
      },
    ],
    "fromRelationships": {},
    "toRelationships": {
      "isProcessOf": [
        "PROCESS_GROUP_INSTANCE-0014EF34F2D03461",
        "PROCESS_GROUP_INSTANCE-306710DC5239D390"
      ],
      "isSiteOf": [
        "GEOLOC_SITE-2D77938DBFF32A41",
        "AZURE_REGION-D4D61746B479FE16"
      ],
      "runsOn": [
        "PROCESS_GROUP-1527B48A2A57385A",
        "PROCESS_GROUP-25544B628ABEDFAB"
      ]
    },
    "osType": "WINDOWS",
    "osArchitecture": "X86",
    "osVersion": "Windows Server 2016 Datacenter",
    "hypervisorType": "HYPERV",
    "ipAddresses": [
      "127.0.0.1"
    ],
    "bitness": "64bit",
    "cpuCores": 2,
    "logicalCpuCores": 2,
    "cloudType": "AZURE",
    "paasType": "AZURE_WEBSITES",
    "paasMemoryLimit": 3583,
    "azureHostNames": [
      "contosomomentshkai3q.azurewebsites.net"
    ],
    "azureSiteNames": [
      "contosomomentshkai3q"
    ],
    "azureComputeModeName": "DEDICATED",
    "azureSku": "STANDARD",
    "consumedHostUnits": 0.25,
    "managementZones": [
      {
        "id": "5130731705740636866",
        "name": "Windows"
      }
    ]
  }
]

Response code

200