What is the best method to work with API extracted data?

Hello all,

I hope I will make my question clear;

I want to extract data using Dynatrace API, to look for hosts that are listed as “Monitoring Candidate” and so on…

I find it hard to work with the extracted data from the API, for example, if I’m extracting the list of hosts, I see many parameters I don’t need. I want for example to filter only the “Monitoring Candidates” but I don’t know how.

You guys have any tips? a software I can use to work with?

Thank you.

Hi @YuvalKonstanti

In order to make the output more useful you can:

  1. Convert the json to csv with some online converters and work on the CSV.
  2. Use Host Report (by Erik Landsness) just save it to your google drive, add your tenant id and token in config tab and run it from the dynatrace menu entry.
  3. Connect your rest API with your company BI tools and play with data as you like.

HTH

Yos

The new /api/v2 “monitored entities” set of endpoints make this easier.

First, have a look at the possible properties for a particular entity (eg. HOST)

GET https://abc12345.live.dynatrace.com/api/v2/entityTypes/ENTITY-TYPE<br>eg.<br>GET https://abc12345.live.dynatrace.com/api/v2/entityTypes/HOST

Gives:

{
  "type": "HOST",
  "displayName": "Host",
  "dimensionKey": "dt.entity.host",
  "entityLimitExceeded": false,
  "properties": [<br>    ...
{
      "id": "isMonitoringCandidate",
      "type": "Boolean",
      "displayName": "isMonitoringCandidate"
    }<br>    ...<br>  ]

Now get the hosts and ask for that additional property:

GET https://abc12345.live.dynatrace.com/api/v2/entities?entitySelector=type(HOST)&fields=properties.isMonitoringCandidate

Gives

<span>{</span>
  <span>"totalCount"</span><span>:</span> <span>1</span><span>,</span>
  <span>"pageSize"</span><span>:</span> <span>50</span><span>,</span>
  <span>"entities"</span><span>:</span> <span>[</span><span>{</span>
      <span>"entityId"</span><span>:</span> <span>"HOST-1234706CD0451ABC"</span><span>,</span>
      <span>"displayName"</span><span>:</span> <span>"myHostname"</span><span>,</span>
      <span>"properties"</span><span>:</span> <span>{</span>
        <span>"isMonitoringCandidate"</span><span>:</span> <span>false</span>
      <span>}</span>
    <span>}</span><span>]</span>
<span>}</span>
GET https://abc12345.live.dynatrace.com/api/v2/entities?entitySelector=type(HOST)&fields=properties.isMonitoringCandidate

To see all valid properties for an entity:

https://abc12345.live.dynatrace.com/api/v2/entityTypes/HOST