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

Modify MW using API with playbooks

mosemont1
Visitor

Hi, 

we are trying to automate some manual actions. One of them is to enable MW when a server-planned restart is running, using API with playbooks.

We have defined a new MW for this case.

I suppose now we have to define two actions, enable/disable it, but not sure how to do it.

We run Get All Objects and obtain our MW: 

_________________________________________________________________________

"objectId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

      "value": {

        "enabled": false,

        "generalProperties": {

          "name": "Ventana reinicio",

          "maintenanceType": "UNPLANNED",

          "suppression": "DETECT_PROBLEMS_DONT_ALERT",

          "disableSyntheticMonitorExecution": false

        },

        "schedule": {

          "scheduleType": "ONCE",

          "onceRecurrence": {

            "startTime": "2022-10-27T10:26:00",

            "endTime": "2022-10-27T11:26:00",

            "timeZone": "UTC"

          }

        },

        "filters": [

          {

            "entityType": "SYNTHETIC_TEST",

            "entityTags": [

              "XXXX"

            ],

            "managementZones": []

          },

          {

            "entityType": "PROCESS_GROUP",

            "entityTags": [

              "ENVIRONMENT:PRO",

              "APP:XXXX"

            ],

            "managementZones": []

          }

        ]

___________________________________________________________

-Enable: 

"enabled": true,

"startTime": "now()",

"endTime": "now()+1",

 

-Disable:

"enabled": false,

 

How should I write this??

Regards

1 REPLY 1

ChadTurner
DynaMight Legend
DynaMight Legend

I recommend defining it out via the UI then using the API to pull the code for the MW. Then one could always just update the end time. 

We integrated with the CICD Pipeline for servers so the users use a template and supply the host name, the start and end date/time then posts it. 

Terraform also leverages a pretty cool integration as deployment as code. 

-Chad

Featured Posts