azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Create alert on CosmosDB timeaggregation

Open abhiramani-iptiq opened this issue 8 years ago • 8 comments

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.

abhiramani-iptiq avatar Oct 12 '18 15:10 abhiramani-iptiq

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.

tjprescott avatar Oct 12 '18 15:10 tjprescott

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.

abhiramani-iptiq avatar Oct 12 '18 15:10 abhiramani-iptiq

How did you create the rule initially?

tjprescott avatar Oct 12 '18 23:10 tjprescott

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.

abhiramani-iptiq avatar Oct 12 '18 23:10 abhiramani-iptiq

So you created the first rule... using the portal?

tjprescott avatar Oct 13 '18 23:10 tjprescott

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 avatar Oct 14 '18 04:10 abhiramani-iptiq

@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.

tjprescott avatar Oct 15 '18 15:10 tjprescott

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?

snehithm avatar Jul 01 '19 14:07 snehithm