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

az monitor metrics alert create doesn't allow metric names to have certain special characters.

Open snehithm opened this issue 8 years ago • 5 comments

Describe the bug When the metric name has a '/' in it, CLI ignores the / and sends it to API which cause a metric not found error.

To Reproduce az monitor metrics alert create -g anashahRG -n SlowBrowserLoad --scopes /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/anashahRG/providers/microsoft.insights/components/abvarma --description "average browser load time" --condition "avg browserTimings/totalDuration > 125" --window-size 5m --evaluation-frequency 5m --action /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourcegroups/acmetelco2/providers/microsoft.insights/actiongroups/teste --severity 1 on any application insights resource

Expected behavior az monitor metrics alert commands need to allow for '/' in the metric name

Environment summary Install Method = MSI / CLI version = 2.0.46 / OS version = Windows 10 1803 (OS Build 17134.345)/ Shell Type= cmd.exe

Additional context For a list of metric names see this page. Metric names can have ".","/","_" in them.

snehithm avatar Oct 17 '18 20:10 snehithm

@tjprescott FYI

snehithm avatar Oct 17 '18 21:10 snehithm

@tjprescott What about allowing other special character like '%' and '-' ? --condition "avg Average_% Available Memory >= 90 where Computer includes vm-01"

I get error: line 1:13 token recognition error at: '%' line 1:64 token recognition error at: '-'

I am using 2.0.51 az cli.

Thank you

esuparno avatar Nov 28 '18 00:11 esuparno

@snehithm for comment

tjprescott avatar Nov 28 '18 01:11 tjprescott

@tjprescott Sorry for the long delay here.

  • Please allow for metric names to have following special characters. Based on metrics list here
    • Period
    • Underscore
    • Hyphen
    • Forward Slash
    • Backward Slash
    • Colon
  • Please allow for resource names to have Alphanumeric, hyphen, and period per ARM guidelines

snehithm avatar Dec 24 '18 14:12 snehithm

@snehithm @esuparno I've created a PR (#8242) to add support for these special characters. It should be in the next release (end of Jan)

tjprescott avatar Jan 14 '19 18:01 tjprescott