Format-MetricsAsTable
Applies To: Azure PowerShell 1.0
Format-MetricsAsTable
Formats a list of metrics.
Syntax
Parameter Set: Default
Format-MetricsAsTable [-Metrics] <Metric[]> [ <CommonParameters>]
Detailed Description
The Format-MetricsAsTable cmdlet formats the output of the Get-Metrics cmdlet as an array of records, one for each metric value.
The output of this cmdlet is suitable for the Export-Csv cmdlet to process.
Parameters
-Metrics<Metric[]>
Specifies an array of Metric objects. This can be the output of the Get-Metrics cmdlet.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1: Export metrics to Excel
This command exports the output of Get-Metrics to a csv file that Excel can read.
PS C:\> $S = Get-Metrics -ResourceId "/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/ResourceGroups/Contoso-Web-EastUS/providers/microsoft.web/sites/PattiFuller01" -TimeGrain 00:01:00 -DetailedOutput
PS C:\> $S2 = Format-MetricsAsTable $S
PS C:\> foreach($E in $S2) { Export-csv -Path ./metrics.csv -input $E -Append -NoTypeInformation}
Contents of CSV file:
"Name","TimestampUTC","Count","Last","Maximum","Minimum","Total","Average","StartTimeUTC","EndTimeUTC","TimeGrain","Unit","DimensionName","DimensionValue","ResourceId"
"AverageResponseTime","2015-03-20 16:15:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/ResourceGroups/Contoso-Web-EastUS/providers/microsoft.web/sites/website1"
"AverageResponseTime","2015-03-20 16:17:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/ResourceGroups/Contoso-Web-EastUS/providers/microsoft.web/sites/website1"
"AverageResponseTime","2015-03-20 16:18:00","1",,,,"0","0","2015-03-20 16:14:00","2015-03-20 17:14:35","00:01:00","Seconds",,,"/subscriptions/b91eb07f-89c3-40be-bf3b-40fdcba10f6c/ResourceGroups/Contoso-Web-EastUS/providers/microsoft.web/sites/website1"