Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

az monitor metrics alert dimension create #20746

Open shaunsat opened 2 years ago

shaunsat commented 2 years ago

I am trying to create a dimension as follows:

az monitor metrics alert dimension create --name ObjectName --operator Include --value "Logical Disk" --subscription $subID

When the alert is created the ObjectName creates two values "Logical" and "Disk" rather than the single value of "Logical Disk" which I want for Linux disk space


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

jiasli commented 2 years ago

Adding @kairu-ms to help.

mateuszstruzik commented 2 years ago

Hi

Are you guys have some solution for this problem ? Basically it is blocking me for now and i am wondering is there some work around

YuanyuanNi commented 2 years ago

Hi: You can solve this issue in this way: (1) create a dimension which value only has one word(without blank) (2) use ' az monitor metrics alert update -n XXX -g XXX --set criteria.allOf[0].dimensions[0].values[0]="XXXXXX(the one you want actually)" ' to update the dimension value

Best wishes.

shaunsat commented 2 years ago

Hi,

Yes that works; after working through this further I found that monitoring "Logical Disk" is a bit useless (not a Linux guy). What needs to be monitored is the mount points. Another bug for you; if you enter --value "/var/lib" it will complain (cant seem to escape characters out) and stripe anything away after the first folder depth so entry would be /var.

The --set parameter gets around this but can be fiddly for a number of mount points and a lot of extra code.

You also can't use wildcards, like /var/lib/*

Thanks