23 Feb 2019 01:38 PM - last edited on 13 Dec 2021 10:59 AM by MaciejNeumann
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.
Solved! Go to Solution.
23 Feb 2019 05:51 PM
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
24 Feb 2019 06:24 AM - last edited on 16 Oct 2023 03:47 PM by random_user
24 Feb 2019 10:36 PM
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": {
"actualMonitoringState": "ON",
"expectedMonitoringState": "ON",
"restartRequired": false
},
Then you can process restartRequired parameter and check which ones are true.
25 Feb 2019 07:30 AM
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
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