28 Apr 2021 09:43 AM - last edited on 18 Nov 2021 01:34 PM by MaciejNeumann
Hi I am trying to automate the Process Group Monitoring Rule in Dynatrace but I am unable to find any POST API for this, please let me know if any available or any other way to automate it.
Solved! Go to Solution.
28 Apr 2021 10:03 AM
Unfortunately there is no API for this yet. You can vote for my RFE here.
26 Apr 2022 02:26 PM
As @pahofmann and @mark_bley are mentioning in the related Product Idea, this is now possible through Settings API.
You can try following payload and send it to "/api/v2/settings/objects"
[
{
"schemaVersion": "1.0.7",
"schemaId": "builtin:declarativegrouping",
"scope": "environment",
"value": {
"enabled": true,
"name": "MY TEST",
"detection": [
{
"id": "MY TEST",
"processGroupName": "Some PG Name",
"rules": [
{
"property": "executablePath",
"condition": "$eq(/path/to/exec)"
}
]
}
]
}
}
]
30 May 2022 12:46 PM
Hi @MaciejNeumann,
I have tried the above API and it's not working. I am getting 400 error. Also documentation is not clear.
Could you please check.
30 May 2022 04:01 PM
A 400 (Bad Request) means somthing is wrong with the payload you are trying to send.
It should also list a message with the problem (e.g. which part of the json could not be parsed).
31 May 2022 03:27 PM
Hi @pahofmann,
I used exact same payload as above also tried from the API documentation it's not working.
Also documentation is not clear like what are the valid schema id's
31 May 2022 07:47 PM
I'd be easier if you could post the output from your request. It should list what is wrong.
You can get the schema id's either from the UI as mentioned above or from the dedicated endpoint for it.
07 Jun 2022 02:13 PM - edited 07 Jun 2022 02:17 PM
Hi @pahofmann,
Payload:
[{
"schemaId": "builtin:process.custom-process-monitoring-rule",
"scope": "environment",
"value":{
"autoMonitoring": true
}
}]
I am getting below error:
[
{
"code": 400,
"error": {
"code": 400,
"message": "Validation failed for 4 Validators.",
"constraintViolations": [
{
"path": "builtin:process.custom-process-monitoring-rule/0/mode",
"message": "Given property 'mode' with value: 'null' does not comply with required NonNull of schema",
"parameterLocation": "PAYLOAD_BODY",
"location": null
},
{
"path": "builtin:process.custom-process-monitoring-rule/0/condition",
"message": "Given property 'condition' with value: 'null' does not comply with required NonNull of schema",
"parameterLocation": "PAYLOAD_BODY",
"location": null
},
{
"path": "builtin:process.custom-process-monitoring-rule/0/autoMonitoring",
"message": "Given property 'autoMonitoring' with value: 'true' was not found in the schema",
"parameterLocation": "PAYLOAD_BODY",
"location": null
},
{
"path": "builtin:process.custom-process-monitoring-rule/0/enabled",
"message": "Given property 'enabled' with value: 'null' does not comply with required NonNull of schema",
"parameterLocation": "PAYLOAD_BODY",
"location": null
}
]
},
"invalidValue": {
"autoMonitoring": true
}
}
]
07 Jun 2022 02:32 PM
Well it lists all the values that must be present that you are missing.
You can check the schema via /settings/schemas/{schemaId} to to see all the fields.
Or you can just create a setting in the GUI and then list all the objects from the schema via /settings/objects to check what it should look like.
09 Jun 2022 10:49 AM
Hi @pahofmann,
Thanks I am able to create custom process monitoring rule.
Below is the example payload used.
[
{
"schemaId": "builtin:process.custom-process-monitoring-rule",
"scope": "environment",
"value": {
"enabled": true,
"mode": "MONITORING_ON",
"condition": {
"item": "IIS_APP_POOL",
"operator": "STARTS",
"value": "Demo"
}
}
}
]