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

Disabling bunch of synthetic monitors for particular time period in a week


Hi Folks,

Is there a way we can disable the few selected synthetic monitors for the day of week and also enabled them back?

Basically, I'm looking to automate this task. I checked on synthetic API but we need to pass complete synthetic monitor JSON with "enabled" parameter as "false" or "true".

I don't want to use Maintenance window as it has some drawbacks.

Has anyone did this?





What you could do is repost your synthetic and pass the parameter of false instead of true:


Thank You Chad for your comments. I'm looking for some automated way to do it.


At the moment, you should be able to do this through the API.

Please check out:

Exellent. Thanks for this Antonio. It worked like a charm.

@Antonio S.

Script was working very well till now but it is started failing. Can you please help here?

Below is the error I'm receiving,

"E:\DynaTrace\", line 98, in <module>
    response = restApiGet(domain+"api/v1/synthetic/monitors?tag="+tag+"&Api-Token="+apiToken)
  File "E:\DynaTrace\", line 15, in restApiGet
    if int(response.headers['X-RateLimit-Remaining']) == 0:
  File "C:\Program Files\Python39\lib\site-packages\requests\", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'x-ratelimit-remaining'
waiting for 5 seconds
Reading contents of Error.log file

Is it the case that dynatrace API are not passing/using x-ratelimit-remaining header is now?



@Antonio S.

I tried it for just four monitors but its failing for them too.

Please beware that the rate limit applies for all API calls. Please check you are not using too much of them... If not, you should probably open a support case, or at least try the Chat.

Hi Antonio,

We came to know from support that,

Those throttling headers (X-RateLimit) will no longer in use from SaaS 1.210 version and new implementation now relies on a rapidly refreshing thread pool that processes API rather than a threshold of calls that is used per minute or hour.
And sleep time must be added based on the HTTP 429 response and then try again shortly after

In our python script (The one which is present on git), sleeping is added based on the X-RateLimit-Reset threshold.

I believe, adding random time.sleep won't be appropriate.

Can you help or suggest, how we can adopt or modify the time.sleep based on HTTP 429 response or when throttling headers are not available?



Not sure about this new implementation... Did Support make any suggestion?

It's resolved. Support suggested to add,

if response.status_code == 429;

Queue will get completed within 10 sec.

Dynatrace Champion
Dynatrace Champion

I'd highly recommend using our open source tool monaco rather than troubling yourself with scripting against our APIs 🙂 #makeyourlifeeasier

That said, see my other comment about this being available OOTB when you create maintenance windows now.


We accomplished this by creating a Jenkins job that runs the commands to disable / enable at the desired times. We use a tag on designated the synthetics that are disables/enables.


We also use tags to specify when a synthetic should be enabled/disabled and another job uses the API to do the enable/disable.

Dynatrace Champion
Dynatrace Champion

This is now available when you create a maintenance window (notice the toggle at the bottom of my image).