-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'MonitorManagementClient' object has no attribute 'metric_definitions' #1743
Comments
Hum, that's strange, there is definitely metric_definitions in this class. Based on your content, you have the 0.3.0 version installed. Could you:
|
Hi, Yes, I found the class related information in the source.
Thank you for your support. |
Hi, I guess I have found the solution. Unfortunately I do not know how did it happen.
Finally I have checked the "metric_definitions" attribute at "MonitorManagementClient" object. This means we win and the required version of "azure-mgmt-monitor" is available from now. Do you have any idea how it could happen? Thank you for your help again. |
This can happen if you use an old version of virtualenv, and you install the package in the system and then in the virtualenv. This flag was by default in old versions: But since you didn't talk about virtualenv, I guess it's not that. One other solution would be if your "pip" does not use your default "python". To be sure your pip and your Python are the same, "python -m pip" will execute the pip installed for your Python. The best way to have known, would have been to check |
Hi,
I would like to manage the Azure subscription related metrics and alerts from Python. I have started the discovering of capabilities of this area and I am facing an serious issue.
I am following this article: https://docs.microsoft.com/en-us/python/api/overview/azure/monitoring?view=azure-python
After this line I receive an error message.
for metric in client.metric_definitions.list(resource_id): # azure.monitor.models.MetricDefinition print("{}: id={}, unit={}".format( metric.name.localized_value, metric.name.value, metric.unit ))
The error message is this:
AttributeError: 'MonitorManagementClient' object has no attribute 'metric_definitions'
Then I checked the client object and I relaized there is not "metric_definitions" in "MonitorManagementClient"
>>> dir(client)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_client', '_deserialize', '_serialize', 'activity_log_alerts', 'alert_rule_incidents', 'alert_rules', 'autoscale_settings', 'config', 'log_profiles', 'service_diagnostic_settings']
Package version: azure-mgmt-monitor (0.4.0)
May be this is my fault. Please help me to correct me if I am wrong...
Thank you for your support in this matter.
The text was updated successfully, but these errors were encountered: