Create alert on CosmosDB timeaggregation
if i create Available storage metric alert on Cosmos DB and then describe it,it shows timeAggregation "last"
"odatatype": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "operator": "LessThan", "threshold": 1073741823.0, "timeAggregation": "Last", "windowSize": "0:30:00"
but if i try creating same alert using CLi i get error "last" not supported
resourceName=myDBName resourceGroupName=myResourceGroupName id=$(az resource show --name $myDBName --resource-group $myResourceGroupName --resource-type "Microsoft.DocumentDb/databaseAccounts" --query "id" --output tsv)
az monitor alert create -n rule1 -g iptiq-microsvc-dev-eus2-rg --target $id
--condition "Available Storage < 1073741823 last 30m"
--action email [email protected] \
[Enter feedback here]
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 5f601495-154d-5e5c-3692-02f8f41516f7
- Version Independent ID: 2968e230-b7a0-b433-333a-af3bba69fd0e
- Content: az monitor alert
- Content Source: src/command_modules/azure-cli-monitor/azure/cli/command_modules/monitor/_help.py
- Service: monitoring-and-diagnostics
- GitHub Login: @rloutlaw
- Microsoft Alias: routlaw
Hi @abhiramani-iptiq the az monitor alert commands are deprecated in favor of the az monitor metrics alert commands and are no longer being updated. Please try the new commands and open an issue if they don't work as you expect.
Hi, Metric alerts are not supported for CosmosDB so classic alert is the only choice?
Thanks
From: Travis Prescott [mailto:[email protected]] Sent: Friday, October 12, 2018 11:12 AM To: Azure/azure-cli [email protected] Cc: Abhijit Ramani [email protected]; Mention [email protected] Subject: Re: [Azure/azure-cli] Create alert on CosmosDB timeaggregation (#7554)
Hi @abhiramani-iptiqhttps://github.com/abhiramani-iptiq the az monitor alert commands are deprecated in favor of the az monitor metrics alert commands and are no longer being updated. Please try the new commands and open an issue if they don't work as you expect.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-cli/issues/7554#issuecomment-429359829, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Am6WscoU0xP9kvpNdOCECRlmQtAsii8Uks5ukLFcgaJpZM4XZpaT.
How did you create the rule initially?
I created first alert using frontend checked timeAggression using show command and verified it shows last So I am trying to create second alert using cli and it says last not supported
Abhijit Ramani | Cloud Infrastructure DevOps Engineer | ASSISTANT VICE PRESIDENT | iptiQ Americas L&H iptiQ Americas Inc. | 175 King Street, 10504 ARMONK, UNITED STATES (USA) Direct: +1 914 828 8397 Fax: +1 914 828 7397 Email: [email protected]mailto:[email protected]
From: Travis Prescott [mailto:[email protected]] Sent: Friday, October 12, 2018 7:11 PM To: Azure/azure-cli [email protected] Cc: Abhijit Ramani [email protected]; Mention [email protected] Subject: Re: [Azure/azure-cli] Create alert on CosmosDB timeaggregation (#7554)
How did you create the rule initially?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-cli/issues/7554#issuecomment-429486427, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Am6WsU7RDDUEHYWujUJT85jmHS5_DjJpks5ukSF9gaJpZM4XZpaT.
So you created the first rule... using the portal?
Yes
Sent from my iPhone
On Oct 13, 2018, at 7:32 PM, Travis Prescott <[email protected]mailto:[email protected]> wrote:
So you created the first rule... using the portal?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-cli/issues/7554#issuecomment-429583729, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Am6WscdlI7El9m1qi-9nlzMl-k3dufimks5ukngMgaJpZM4XZpaT.
@abhiramani-iptiq thank you. It looks like the portal is doing some stuff to work around a service-side issue. The service team will need to look into this.
However, I was able to create the equivalent rule using the new metric alerts API. It looks like:
monitor metrics alert create -g {rg} -n {name} --scopes /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DocumentDB/databaseAccounts/{db-name} --condition "total AvailableStorage < 1073741823" --description "My Rule" --window-size 30m
The scenario is supported but does not appear on the main blade for the CosmosDB resource. However, if you go to the Monitor page and then Alerts > Manage Alert Rules you can see and modify it.
Hope that helps.
We are cleaning up old issues and this has caught our attention. Cosmos DB resource blade now shows the new alerts blade. New metric alerts are supported on CosmosDB resources.
@tjprescott Can you please close this issue?