cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to enable/disable Full Stack monitoring via API?

nakb
Guide

I am using OneAgent monitoring configuration API to enable/disable Full Stack monitoring but getting below in valid input error.

 

https://www.dynatrace.com/support/help/dynatrace-api/configuration-api/oneagent-configuration/oneage...

 

JSON

{
      "id""HOST-15B7fffffE",
      "monitoringEnabled"true,
      "monitoringMode""FULL_STACK"
}
 

 

 

 

 

Failed. The input is invalid

{
  "error": {
    "constraintViolations": [
      {
        "parameterLocation": "PATH",
        "location": "string",
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "code": 0
  }
}

 

 

 

 

2 REPLIES 2

The_AM
Dynatrace Champion
Dynatrace Champion

Hi Naveen,

The Host ID appears in the body of the GET request. But for the PUT, it is only needed on the path. The JSON should only contain monitoringEnabled and monitoringMode.

An example cURL request will look something like:

curl -X PUT "https://{tenant-ID}.live.dynatrace.com/api/config/v1/hosts/HOST-ID12345/monitoring" -H  "accept: */*" -H  "Authorization: Api-Token {token-value}" -H  "Content-Type: application/json; charset=utf-8" -d "{\"monitoringEnabled\":true,\"monitoringMode\":\"FULL_STACK\"}"

 

Since the Dynatrace Help topic for API doesn't really make it clear, instead I recommend you use the in-product REST API reference (SwaggerUI specification) since you can also "try out" the API PUT requests on the live environment and get the correct specification.

 

The_AM_1-1620006836894.png

 

The URL will look like: https://{YOUR-ENVIRONMENT-ID}.live.dynatrace.com/rest-api-doc/index.jsp?urls.primaryName=Configuration%20API#/

Regards,
Andrew M.

nakb
Guide

Thanks The_AM working fine.

Featured Posts