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

Deploy a Maintenance Window

alcq
Visitor

Greetings everyone,

 

In the case of my internship, my job is to "automate" the deployement of maintenance windows without using the web interface.

As I'm beginner with Dynatrace, I was wondering how to use the Dynatrace's API to deploy a maintenance window ?

Furthermore, if you can give a detailled example of how to use the API, it would be great as I don't really understand how to use the endpoint or anything else.

Kind regards,

 

Arthur

6 REPLIES 6

Hi @alcq ,

First, you have to generate access token with settings.read and settings.write permissions. Explanation how to do this you can find here: https://docs.dynatrace.com/docs/manage/access-control/access-tokens

If you generated access token you have to click on your user icon in top right corner, then go to Environment API v2. Search for Settings – Objects and Settings – Schemas. This is your default tool to interact with Dynatrace API (of course you can use another tool like Postman if you want). Before you can use it you have to authorize yourself by clocking on locker icon and pass your previously generated token. Through button “Try it out” you can run your queries.

To work with maintenance windows you use schema: builtin:alerting.maintenance-window.

Any info about available schema fields you can find here: https://docs.dynatrace.com/docs/dynatrace-api/environment-api/settings/schemas/builtin-alerting-main...

How to use settings API you can read here: https://docs.dynatrace.com/docs/dynatrace-api/environment-api/settings


I highly recommend testing out Your payload/body using dynatrace built-in swagger before implementing it inside of some pipeline.

Bests
Michal

alcq
Visitor

Thanks for your reply.

As I see, it appears I can only use "GET" methods to manipulate Maintenance Windows. Are "POST" methods available to create and deploy Maintenance Windows ?

 

Kind regards,

 

Arthur

Hi @alcq 
Yes, of course. In "Settings – Objects" in Environment API v2 you can post an object to create a new settings object.

MichalOlszewski_0-1716367780697.png

Bests
Michal

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

You can have a look a Monaco, it is a command line tool to deploy Dynatrace's configurations. Maintenance windows API is supported.

Best regards

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

Thanks for your reply.

 

As I see, I can deploy a maintenance window thanks to monaco. What I need to do is just to construct a YAML file to fit with all needed paramaters for a maintenance window, am I right ?

If it's the case, how should I find the structure to edit and put into the YAML file ?

 

Kind regards,

Arthur

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

I would recommend you create some configuration in the UI, download configuration and analize YAML and JSON files created.

Later you can modify those files base on your needs but you do not need to start from scratch.

Best regards

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

Featured Posts