11 Jun 2024 08:04 AM - last edited on 11 Jun 2024 08:18 AM by MaciejNeumann
Hello all,
We are using a custom OneAgent extension that displays certain fields for its own configuration.
We have thousands of hosts having this extension used and configured.
(On premise Dynatrace)
I am wondering how to get all those configuration elements by API ? To get a result like field name:field value for each host in a json.
Thx and regards.
Pierre
Solved! Go to Solution.
11 Jun 2024 10:59 AM
you can get each host extension data using extension API (example below)
Then You can do a script to iterate on step 5 and trigger step 6 for each result from step5
1 - Generate token with - read config
2 - go to configuration API and authorize
3 - Find "/extension" and list all avaiable extension:
/api/config/v1/extensions?pageSize=200
4 - copy id of you extension for example:
custom.python.cert_plugin
5 - use id as parameter for "extensions/{id}/instances"
/api/config/v1/extensions/custom.python.cert_plugin/instances?pageSize=200
you will get list of custom configured instances:
{
"configurationsList": [
{
"id": "HOST-4544E85D1B018C76"
}
],
"totalResults": 1
}
6 - now go to "extensions/{id}/instances/{configurationId}"
fill id and configurationID:
/api/config/v1/extensions/custom.python.cert_plugin/instances/HOST-4544E85D1B018C76'
in response you will get configuration of plugin in specific host:
{
"extensionId": "custom.python.cert_plugin",
"enabled": true,
"useGlobal": false,
"properties": {
"CertList": "",
"ExpDays": "366",
"Split": ";",
"LogFileLocation": "C:\\ProgramData\\dynatrace\\oneagent\\log\\plugin\\",
"DebugLevel": "INFO"
},
"hostId": "HOST-4544E85D1B018C76"
}
Hope it helps
Bests
Michal
11 Jun 2024 03:59 PM
Thanks a lot Michal, it works perfectly !