MicrosoftDocs / azure-docs-cli

Repository used to store content for the docs.microsoft.com content for the Azure CLI
https://docs.microsoft.com/cli/azure/
Creative Commons Attribution 4.0 International
210 stars 482 forks source link

--add-condition for az monitor metrics alert update #4675

Closed codegiverazure closed 5 days ago

codegiverazure commented 1 week ago

Type of issue

Missing information

Feedback

Hi Team,

I am trying to run az monitor metrics alert update but --add-condition documentation isnt clear enough and also no example are provided. I am trying to update the threshold value from 0 to 10 but cannot proceed becuase lack of documentation and example. Please help. Following I am running command: az monitor metrics alert update --resource-group batr-app-a-rg --name "Failed SQL Connections" --add-condition "GreaterThan connection_Failed >10"

Page URL

https://learn.microsoft.com/en-us/cli/azure/monitor/metrics/alert?view=azure-cli-latest

Content source URL

https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/monitor/metrics/alert.yml

Author

@dbradish-microsoft

Document Id

0cde4f15-6464-3106-b787-3ee37c7de0ee

dbradish-microsoft commented 1 week ago

Hello, @codegiverazure. There are several articles that talk about or use az monitor metrics alert in the Azure CLI A to Z article list -- Azure Monitor. (Scroll down in the list once you open the link.)

I'm seeing an example of the --condition parameter when creating a new alert here and there are several --condition examples given in Modify alert rules. Did you see the examples in Create metric alert in Azure CLI?

I understand from your feedback that you are looking specifically for an update command example, and I will pass your request on to the engineering team.

codegiverazure commented 1 week ago

Hi MicrosoftDocs/azure-docs-cli,

Yes, I am looking for update existing alerts and threshold value using CLI.

I see very less example. Please let me know how I can get help.

On Thu, Oct 10, 2024, 1:09 AM Delora Bradish @.***> wrote:

Hello, @codegiverazure https://github.com/codegiverazure. There are several articles that talk about or use az monitor metrics alert in the Azure CLI A to Z article list -- Azure Monitor https://learn.microsoft.com/en-us/cli/azure/reference-docs-index?view=azure-cli-latest#az-monitor. (Scroll down in the list once you open the link.)

I'm seeing an example of the --condition parameter when creating a new alert here https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-rule-cli-powershell-arm#create-a-new-alert-rule-using-the-cli and there are several --condition examples given in Modify alert rules https://learn.microsoft.com/en-us/azure/azure-monitor/app/release-and-work-item-insights?tabs=continuous-monitoring#modify-alert-rules. Did you see the examples in Create metric alert in Azure CLI https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/azure-cli-metrics-alert-sample ?

I understand from your feedback that you are looking specifically for an update command example, and I will pass your request on to the engineering team.

— Reply to this email directly, view it on GitHub https://github.com/MicrosoftDocs/azure-docs-cli/issues/4675#issuecomment-2403593089, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXL2LRM4JDH5PJG23552KALZ2WZUDAVCNFSM6AAAAABPUXCEBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBTGU4TGMBYHE . You are receiving this because you were mentioned.Message ID: @.***>

TPavanBalaji commented 1 week ago

@codegiverazure Thank you for bringing this to our attention. I've delegated this to content author, who will review it and offer their insightful opinions.

dbradish-microsoft commented 5 days ago

@codegiverazure , the accepted parameter values for the create and update commands are the same. Modify one of these examples to be what you need:

--condition 'avg availabilityResults/availabilityPercentage < 99'
--condition 'count requests/failed > 5'
--condition 'avg requests/duration > 5'
--condition 'count exceptions/server > 5'

There are additional examples in Create metric alert in Azure CLI.

codegiverazure commented 3 days ago

Hi,

I am wondering, If I want to update the threshold value of exsiting metric for SQL System Connection Failed , what should be the AZ command for it. For example when I executed below command, it added new condition rather updating exisiting threshold value from 0 to 5

az monitor metrics alert update --resource-group --name "Failed SQL Connections" --add-condition "count connection_Failed > 5"

@dbradish-microsoft

dbradish-microsoft commented 16 hours ago

That's correct, @codegiverazure . You passed the --add-condition parameter.