12 Sep 2023 11:18 AM
Hi,
I want to get the ID on alertingprofile.
I use Dynatrace environment API / Settings - Objects.
In the output of [GET] /settings/objects I have objectId but not the alertingprofileid. How to get it?
{ "objectId": "XXX", "summary": "Default", "searchSummary": "Default", "created": 1651564175176, "modified": 1651564175176, "author": "default settings creation", "updateToken": "XXX", "scope": "environment", "schemaId": "builtin:alerting.profile", "schemaVersion": "8.3", "modificationInfo": { "deletable": false, "modifiable": true, "movable": true, "modifiablePaths": [], "nonModifiablePaths": [] }, "value": { "name": "Default", "severityRules": [ { "severityLevel": "AVAILABILITY", "delayInMinutes": 0, "tagFilterIncludeMode": "NONE" }, { "severityLevel": "ERRORS", "delayInMinutes": 0, "tagFilterIncludeMode": "NONE" }, { "severityLevel": "PERFORMANCE", "delayInMinutes": 30, "tagFilterIncludeMode": "NONE" }, { "severityLevel": "RESOURCE_CONTENTION", "delayInMinutes": 30, "tagFilterIncludeMode": "NONE" }, { "severityLevel": "CUSTOM_ALERT", "delayInMinutes": 0, "tagFilterIncludeMode": "NONE" }, { "severityLevel": "MONITORING_UNAVAILABLE", "delayInMinutes": 0, "tagFilterIncludeMode": "NONE" } ], "eventFilters": [] } }
In Dynatrace configuration API / Alerting Profiles it is possible to get alertingprofileid but it is deprecated :
{ "values": [ { "description": "Dynatrace entity 1 for the REST API example", "id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a", "name": "Dynatrace entity 1" }, { "id": "ee70f7d3-9a4e-4f5f-94d2-c9d6156f1618", "name": "Dynatrace entity 2" }, { "id": "8cdabe77-9e1a-4be8-b3df-269dd6fa9d7f" } ] }
Any suggestion?
Thx
Solved! Go to Solution.
12 Sep 2023 03:59 PM
You can still use the deprecated method, but the Alert Profile ID is also present in the URL when you select the alert profile form the UI. If that's not possible for you, you can leverage the new API via a 2 part call:
Basically you check the Alert Profiles, find the one you want and grab the Object ID, not the alert profile ID from the URL, then take that Object ID and supply it in the the settings API for that Object ID and you'll have the data you seek
12 Sep 2023 04:37 PM
Thx @ChadTurner for the reply,
With the API I get value like you (objectID). But this value is différent to the id from the UI (alertingprofile).
I try to create "problem notifications" with the 2 value and I get the same result 😞
Is it possible to define alertingProfile with his name ?
Thx
12 Sep 2023 04:59 PM - edited 12 Sep 2023 05:04 PM
Hi,
If you are using Monaco, you can create an alerting profile, and create a problem notification linked to that alerting profile as a reference.
Is this your use case?
Best regards
13 Sep 2023 08:14 AM
Hi @AntonPineiro ,
Yes it is my use case. For profil notification is it possible to define reference without ID? With name of alerting profile?
We have a CMDB with project and we want to use monaco to create SLO, alerting profile and problem notif automaticaly.
Thx
13 Sep 2023 11:22 AM - edited 13 Sep 2023 11:23 AM
Hi,
If you create all entities (alerting profile, problem notification, etc...) using Monaco, maybe it would be easier.
Let me provide you an example. You can create an alerting profile and you choose ID for that alerting profile, a human name:
configs:
- id: XXXXXXXX
type:
settings:
schema: builtin:alerting.profile
scope: environment
config:
name: XXXXXXXX
template: XXXXXXXX.json
And when you create a problem notification, you can reference that alerting profile ID:
configs:
- id: XXXXXXXX
type:
settings:
schema: builtin:problem.notifications
scope: environment
config:
name: XXXXXXXX
parameters:
alerting_profile_id:
project: alerting-profiles
configId: XXXXXXXX
configType: builtin:alerting.profile
property: id
type: reference
recipients:
template: XXXXXXXX.json
"configId" is a reference to id you had chosen defining alerting profile.
If you create everything with Monaco, maybe it would be easier. You have more ways to reference entities in Monaco, checking this.
Best regards
22 Mar 2024 04:11 PM
This is still not solved (despite the answers are marked as solutions), should we somehow parse the objectId and extract the the Alerting Profile ID from there?
Dynatrace must provide the Alerting Profile ID using the current Settings API as the Alerting Profile ID is used in other APIs such as Problem v2 APIs for filtering. Extracting the Alerting Profile ID from Object ID is possible, but probably not recommended as the format of Object ID is not documented and may change.
@florian_APIgner Can we get this fixed please?
08 Aug 2024 10:31 AM - edited 08 Aug 2024 10:32 AM
This comes late but you can still extract the ID from the objectID, it is kind of base64 encoded, monaco goes a similar way https://github.com/Dynatrace/dynatrace-configuration-as-code/blob/main/internal/idutils/numeric_id.g...
% echo "vu9U3hXa3q0AAAABABhidWlsdGluOm1hbmFnZW1lbnQtem9uZXMABnRlbmFudAAGdGVuYW50ACRkNjE2NThhYy1jYjI3LTM1YjAtOWIyMS1hMTY2MWI0ZjE4ZDm-71TeFdrerQ" | base64 --decode
Tbuiltin:management-zonestenanttenant$d61658ac-cb27-35b0-9b21-a1661b4f18d9base64: invalid input
08 Aug 2024 11:07 AM
@mark_bley sure, but this is something internal and as I have written - undocumented and might change. We need a proper solution.