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.
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.
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\Scipt.py", line 98, in <module>
response = restApiGet(domain+"api/v1/synthetic/monitors?tag="+tag+"&Api-Token="+apiToken)
File "E:\DynaTrace\Script.py", line 15, in restApiGet
if int(response.headers['X-RateLimit-Remaining']) == 0:
File "C:\Program Files\Python39\lib\site-packages\requests\structures.py", 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?
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.
Those throttling headers <strong>(X-RateLimit)</strong> 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?