Hi,
I'm trying to create an alert rule over SDK, using documentation and azure-cli module source code. After days of fighting with deficiencies in documentation I was able to (probably) figure out how to create function at all. But after all it is failing with 500 errors. Below I'm sharing my code - please take a look and give some tips on how to do it - then I will create an documentation entry for that and some blog post. Probably a lot of people is trying to use mgmt-monitor but it is just burning hours we could spend on something else - like documentation tweaks ;)
https://gist.github.com/smereczynski/6641e422a6a47e0f9150f9165d1d89be
It is generating:
msrest.exceptions.ClientRequestError: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/xxxxxxxx/resourcegroups/rg_name_pro/providers/microsoft.insights/alertrules/responsetime_gt_10s?api-version=2016-03-01 (Caused by ResponseError('too many 500 error responses',))
H @smereczynski
I know there is no sample right now :/. Thank you for your code, I will take a look and let you know what I think
FYI @vishrutshah
Hi @smereczynski
I added a unittest:
https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt/tests/test_mgmt_monitor.py#L121
In the meantime of a blog post, this should help you to start.
Hi @smereczynski
I made an article about this:
http://azure-sdk-for-python.readthedocs.io/en/latest/sample_azure-monitor.html#alert-rules
Can you confirm this solves your issue?
@vishrutshah do not hesitate if you have comment.
@lmazuel it works! Thank YOU! :) I will create some blog post as soon as possible with some hints on automation, using your sample. We will probably publish our complete scripts set for alerts automation on GH :)
Most helpful comment
Hi @smereczynski
I made an article about this:
http://azure-sdk-for-python.readthedocs.io/en/latest/sample_azure-monitor.html#alert-rules
Can you confirm this solves your issue?
@vishrutshah do not hesitate if you have comment.