Scenario → I’m on deployment status page. We are done with all agents update activity. Now I want to send all these server names and respective ‘restart pending’ processes to a different team. Pls advise how to do it. I don’t want to expand each server and manually copy-paste the processes to a text editor.
Hello.
I am mnot sure it is published out
but you have to study API docs https://www.dynatrace.com/support/help/extend-dyna…
Regards, Igor
You need to build code to query Topology Smartscape Processes API and there you got and example answer like this https://www.dynatrace.com/support/help/extend-dyna…
"monitoringState": {<br> "actualMonitoringState": "ON",<br> "expectedMonitoringState": "ON",<br> "restartRequired": false<br> },
Then you can process restartRequired parameter and check which ones are true.
Here is a "2-liner " using curl and jq, just set the TENANT and APITOKEN environment variables:
curl -X GET "https://$TENANT/api/v1/entity/infrastructure/hosts?relativeTime=day&Api-Token=$APITOKEN" -H "accept: application/json; charset=utf-8" |jq -s '.[]| map({(.entityId): .displayName})|add' >hostsmap<br>curl -X GET "https://$TENANT/api/v1/entity/infrastructure/processes?relativeTime=day&Api-Token=$APITOKEN"| jq -s '.[][]|select ( .monitoringState.restartRequired==true )| .fromRelationships.isProcessOf[0]|=$hosts[.] | { "hostname" : .fromRelationships.isProcessOf[0], "processName": .displayName }' --argfile hosts hostsmap<br>