31 Mar 2025
07:34 PM
- last edited on
01 Apr 2025
07:50 AM
by
MaciejNeumann
Solved! Go to Solution.
01 Apr 2025 11:25 AM
Hi,
As far as I know the only possibility to gather this information is API call to /api/v2/entities (https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/entity-v...). You can filter the data using entitySelector in order to get only process group instances. So I recommend to create a workflow with the JS step that makes an api call, procesess data and then creates an event.
Best Regards
Patryk
01 Apr 2025 01:39 PM
The Problem here is I think this data is coming form the platform itself and not being exposed to the API pushed into EVENTS.
You won't see the values from the State field anywhere in the API output. The only data you get is:
01 Apr 2025 02:47 PM
First API call:
curl -X 'GET' \
'https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22PROCESS_GROUP_INSTANCE%22%29' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token <token>’
Then you iterate through all entityId from the response:
Make API call
curl -X 'GET' \
'https://{environmentid}.live.dynatrace.com/api/v2/monitoringstate?entitySelector=entityId%28%22PROCESS_GROUP_INSTANCE-<id>%22%29' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token <token>’
And in the response you will see for example:
"totalCount": 1,
"monitoringStates": [
{
"entityId": "PROCESS_GROUP_INSTANCE-<id>”,
"state": "restart_required",
"severity": "warning",
"params": [
{
"key": "pids",
"values": ""
}
]
}
],
"pageSize": 500
}
The whole flow can be executed in the Dynatrace Workflow.
Best Regards
Patryk
01 Apr 2025 06:02 PM
I must of typed something wrong. Then I thought it could it be because I am trying this on a Process running in a POD/Container? But I got it to work. Thanks for the assistance.
Response body{ "totalCount": 1, "monitoringStates": [ { "entityId": "PROCESS_GROUP_INSTANCE-CCC9F0446F895C6A", "state": "agent_injection_suppression", "severity": "info", "params": [ { "key": "reason", "values": "statically_linked_go_injection_disabled" } ] } ], "pageSize": 500 } |
01 Apr 2025 06:54 PM
I also found it can be run a Notebook using the Code feature. You can run the JavaScript and call the API and process it within the notebook and produce the tables results.
01 Apr 2025 06:56 PM
It is true but you wanted to create an alert based on this data and it can be done only in the workflows
01 Apr 2025 07:12 PM
Correct! They are very happy with the Notebook. Alerting will be the next discussion. The customer is just starting to look at workflows. But I did give them a good overview of what we would require and next steps.