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?
Solved! Go to Solution.
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__
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?
It looks like you might be experiencing some rate limiting. Take a look at:
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.
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?
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.