You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/load-balancer/load-balancer-monitor-metrics-cli.md
+18-23Lines changed: 18 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,23 +44,19 @@ For metric definitions and further details, refer to [Monitoring load balancer d
44
44
## CLI examples for Load Balancer metrics
45
45
<!-- Introduction paragraph -->
46
46
47
-
The [az monitor metrics](/cli/azure/monitor/metrics)command is used to view Azure resource metrics. To see what metrics are available for Standard Load Balancer resources, you run the `az monitor metrics list-definitions` command.
47
+
The [az monitor metrics](/cli/azure/monitor/metrics)command is used to view Azure resource metrics. To see the metric definition available for a Standard Load Balancer, you run the `az monitor metrics list-definitions` command.
48
48
49
49
```azurecli
50
-
# Display available metrics for Standard Load Balancer resources
50
+
# Display available metric definitions for a Standard Load Balancer resource
51
51
52
-
az monitor metrics list-definitions
52
+
az monitor metrics list-definitions --resource <ResourceName>
53
53
```
54
54
55
-
To retrieve all Standard Load Balancer metrics available using CLI, you can use the `az monitor metrics list` command.
55
+
In the above example and the following examples, replace **<ResourceName>** with the value of your Standard Load Balancer resource in the format of */subscriptions/{subscriptionID}/resourceGroups/{resourceGroup}/Microsoft.Network/networkSecurityGroups/{resourceName}*.
56
56
57
-
```azurecli
58
-
# Retrieve all available Standard Load Balancer metrics
59
-
60
-
az monitor metrics list
61
-
```
57
+
To retrieve Standard Load Balancer metrics for a resource, you can use the `az monitor metrics list` command.
62
58
63
-
Use `--metric DipAvailability` option to collect the Health Probe Status metric from a Standard Load Balancer. By default, az monitor metrics list returns the resource’s metrics from the last hour.
59
+
For example, use the `--metric DipAvailability` option to collect the Health Probe Status metric from a Standard Load Balancer.
64
60
65
61
```azurecli
66
62
@@ -69,26 +65,26 @@ Use `--metric DipAvailability` option to collect the Health Probe Status metric
69
65
az monitor metrics list --resource <ResourceName> --metric DipAvailability
70
66
```
71
67
72
-
When you run the above command, the output will appear as follows:
68
+
When you run the above command, the output for Health Probe status will be like to the following output:
73
69
```output
74
-
...
70
+
user@Azure:~$ az monitor metrics list --resource <ResourceName> --metric DipAvailability
@@ -97,24 +93,23 @@ When you run the above command, the output will appear as follows:
97
93
}
98
94
...
99
95
```
100
-
You can specify the aggregation type for a metric with the –-aggregation parameter. For recommended aggregations, see Monitoring load balancer data reference](./monitor-load-balancer-reference.md).
96
+
You can specify the aggregation type for a metric with the `–-aggregation` parameter. For recommended aggregations, see Monitoring load balancer data reference](./monitor-load-balancer-reference.md).
101
97
102
98
```azurecli
103
99
104
100
# List the average Health Probe Status metric from a Standard Load Balancer
105
101
106
102
az monitor metrics list --resource <ResourceName> --metric DipAvailability --aggregation Average
107
103
```
108
-
109
-
To specify the interval to aggregate metrics, use the `--interval`` parameter and specify a value in ##h##m format. The default interval is
104
+
To specify the interval to metrics, use the `--interval` parameter and specify a value in ##h##m format. The default interval is 1m.
110
105
111
106
```azurecli
112
107
113
108
# List the average List the average Health Probe Status metric from a Standard Load Balancer in 5 minute intervals
114
109
115
110
az monitor metrics list --resource <ResourceName> --metric DipAvailability --aggregation Average --interval 5m
116
111
```
117
-
You can query metric data over a period of time using ``--start-time` and `--end-time` with the format of date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm). To list the average Health Probe Status aggregated per day from May 5, 2022 and May 10, 2022, use the following command:
112
+
By default, az monitor metrics list returns the resource’s aggregate metrics from the last hour. You can query metric data over a period of time using `--start-time` and `--end-time` with the format of date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm). To list the average Health Probe Status aggregated per day from May 5, 2022 and May 10, 2022, use the following command:
118
113
119
114
```azurecli
120
115
# List average Health Probe Status metric aggregated per day from May 5, 2022 and May 10, 2022.
@@ -130,23 +125,23 @@ To split metrics on a dimension, such as “BackendIPAddress”, specify the dim
130
125
```azurecli
131
126
# List average Health Probe Status metric and filter for all BackendIPAddress dimensions
132
127
133
-
az monitor metrics list --resource <ResourceName> --metric DipAvailability --filter “BackendIPAddress eq ‘*’” –aggregation Average
128
+
az monitor metrics list --resource $res --metric DipAvailability --filter "BackendIPAddress eq '*'" --aggregation Average
134
129
```
135
130
136
131
You can also specify a specific dimension value.
137
132
138
133
```azurecli
139
134
# List average Health Probe Status metric and filter for the 10.1.0.4 BackendIPAddress dimension
140
135
141
-
az monitor metrics list --resource <ResourceName> --metric DipAvailability --filter “BackendIPAddress eq ’10.1.0.4’” –aggregation Average
136
+
az monitor metrics list --resource <ResourceName> --metric DipAvailability --filter "BackendIPAddress eq '10.1.0.4'" --aggregation Average
142
137
```
143
138
144
139
In cases where you need to filter on multiple dimension values, specify the `--filter` value using `and` between the values.
145
140
146
141
```azurecli
147
142
# List average Health Probe Status metric and filter for all BackendIPAddress and BackendPort dimensions
148
143
149
-
az monitor metrics list --resource <ResourceName> --metric DipAvailability --filter “BackendIPAddress eq ‘*’ and BackendPort eq ‘*’” –aggregation Average
144
+
az monitor metrics list --resource <ResourceName> --metric DipAvailability --filter "BackendIPAddress eq '*' and BackendPort eq '*'" --aggregation Average
0 commit comments