I want to turn OneAgent ON or OFF on a specific host via the REST API, but I can’t find the specific endpoint to do this. The OneAgent API seems to be read-only.
I am able to get a list of OneAgents from the API, and by searching the response for my server name, I can find the entityID. What endpoint in the REST API can I use to turn OneAgent off on that server?
This is for DynaTrace SaaS.
Hi @DuaneRoelands
Once upon a time we used OneAgent monitoring configuration API - PUT configuration but this API is deprecated.
In order to use the current v2 setting api please go to the setting page of your host under setting --> host monitoring , use the … on the right corner
in order to open the menu
and choose api
just copy the update api call and you are all set!
HTH
Yos
This does not work.
Submitted this payload (taken from the API section of the settings as you instructed:
{“schemaId”:“builtin:host.monitoring”,“schemaVersion”:“1.2.1”,“scope”:“HOST-29200A0CBEF971B4”,“value”:{“enabled”:true,“autoInjection”:true}}Got error 400, “constraints violated”, path “setting must not be null”.I would post the full JSON of the response, but the forum software flags it as invalid HTML and won’t let me post it.
Hi @DuaneRoelands. Please add [] in the payload.
This doesn’t work, either.
Payload:
[{“schemaId”:“builtin:host.monitoring”,“schemaVersion”:“1.2.1”,“scope”:“HOST-29200A0CBEF971B4”,“value”:{“enabled”:true,“autoInjection”:true}}]Response:{ “error”: { “code”: 400, “message”: “Could not map JSON at ‘’ near line 1 column 1” }}Please don’t accept solutions that haven’t been validated.
Hi @DuaneRoelands
Use POST method in the following API:
{{baseUrl}}/settings/objects?validateOnly=true
and change baseUrl placeholder for your tenant/api/v2
then your payload
[
{
"schemaId": "builtin:host.monitoring",
"value": {
"enabled": true,
"fullStack": false,
"autoInjection": true
},
"schemaVersion": "1.2.1",
"scope": "HOST-29200A0CBEF971B4"
}
]
if everything goes right you should receive a
[
{
"code": 200
}
]
Still not working.
Endpoint:
/api/v2/settings/objects?validateOnly=true
Body:
[ { “schemaId”: “builtin:host.monitoring”, “value”: { “enabled”: true, “fullStack”: false, “autoInjection”: true }, “schemaVersion”: “1.2.1”, “scope”: “HOST-29200A0CBEF971B4” }]Response:[ { “code”: 400, “error”: { “code”: 400, “message”: “Validation failed for 1 Validators.”, “constraintViolations”: [ { “path”: “builtin:host.monitoring/0/fullStack”, “message”: “Given property ‘fullStack’ with value: ‘false’ was not found in the schema”, “parameterLocation”: “PAYLOAD_BODY”, “location”: null } ] }, “invalidValue”: { “enabled”: true, “fullStack”: false, “autoInjection”: true } }]
Hi @DuaneRoelands set schema to:
"schemaVersion": "1.2.0",
this should work. Could be a bug on the API.
I query the schema and it is correct:
{
"schemaId": "builtin:host.monitoring",
"displayName": "Monitoring",
"latestSchemaVersion": "1.2.1"
}
Changing the schema version to 1.2.0 worked. Thank you for your assistance!