cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[API] How to get alertingprofile ID

Martin_LEKPA
Visitor

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

8 REPLIES 8

ChadTurner
DynaMight Legend
DynaMight Legend

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: 

ChadTurner_0-1694530636572.png

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 

-Chad

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). 

Martin_LEKPA_0-1694532248117.png

 

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

 

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

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

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

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

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Julius_Loman
DynaMight Legend
DynaMight Legend

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?

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

mark_bley
Dynatrace Champion
Dynatrace Champion

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

 

 

@mark_bley sure, but this is something internal and as I have written - undocumented and might change. We need a proper solution.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts