02 Mar 2023 02:41 PM - last edited on 03 Mar 2023 07:59 AM by MaciejNeumann
I seem to struggle a bit wit the Settings API. I'm trying to list all hosts in my environment that have custom anomaly disk detection configurations. I tried the 'Hierarchy and overrides" but the list it provides is definitely not right.
This is the schema builtin:anomaly-detection.infrastructure-disks.per-disk-override.
I'm trying to list each host that has custom disk-overrides and then list what each of those are. (at the per-disk level) I need to report on this as part of a QA process of our monitors.
I'm looking for any guidance though I admit I'm afraid the solution is going to be a very code-level set of multiple-API calls to obtain. This Settings api is far more complicated than the old API created for each function.
Thanks in advance to anyone with guidance.
Solved! Go to Solution.
04 Mar 2023 06:12 PM
Hi @ct_27
Yep you will need a small automation code that will collect all the object ids with v2/settings/objects and then for each objectId fetch with v2/settings/objects/{objectId} the hostid from the scope filed and if you need the host name .... you know what to do with v1/entity/infrastructure/hosts/{meIdentifier}.
HTH
Yos
04 Mar 2023 08:19 PM
Thank you @Yosi_Neuman for confirming what i was afraid to be the solution.
For those reading this post, I use a product called Node-Red to handle such advanced API call requirements. I suggest others give it a try as a low-code solution to iterate over the results of one API (and pages) to then collect details from a second, third, forth API. Apparently this will be needed if having to use Settings 2.0 API.
Most large companies probably don't have issue with such code dependent approaches because they have multiple resources and developers at hand. I'm in a situation where it's 2 people supporting this service, so we need APIs that are more efficient, require less code, or use low-code solutions to fill in for lack of resources.
Dynatrace I'd be interested to here from your API team why you're trying to move to a One-API-Fits-All solution with Settings 2.0. This is making it more difficult to use Dynatrace.
10 Mar 2023 08:40 PM
I like the settings API a lot. The fact is that the last year a huge amount of possible config was added to Dynatrace. Having separate API's for them would not be better or worse in my opinion. There would just be a lot of them and probably less consistent.
As an alternative for your question you could use monaco v2 (https://github.com/Dynatrace/dynatrace-configuration-as-code/releases/tag/v2.0.0-rc.4) and download the configuration to start with.
But I would also invest in a GitOps approach to maintain the configuration so you know exactly at any time what the deviations of all settings are on all scopes.