Get-AzureWebsiteMetric

Gets metrics for the Azure website in the current subscription.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Get-AzureWebsiteMetric
   [-MetricNames <String[]>]
   [-StartDate <DateTime>]
   [-EndDate <DateTime>]
   [-TimeGrain <String>]
   [-InstanceDetails]
   [-SlotView]
   [-Name <String>]
   [-Slot <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The Get-AzureWebsiteMetric cmdlet gets metrics for the Azure website in the current subscription.

Examples

Example 1: Get metrics for the last three hours on a per-instance level for a website

PS C:\> Get-AzureWebsiteMetric -Name "ContosoWebSite" -StartDate (get-date).AddHours(-3) -MetricNames "Requests" -InstanceDetails -SlotView -TimeGrain "PT1M" 
PS C:\> $metrics[1].Data Name : Requests 

Unit : Count 

StartTime : 8/11/2014 7:05:00 AM 

EndTime : 8/11/2014 5:06:01 PM 

TimeGrain : PT1M 
PrimaryAggregationType : Instance 
Values : {Time:8/11/2014 7:05:00 AM, Total:4, Min:, Max:, Time:8/11/2014 7:06:00 AM, Total:3, Min:, Max:, 
Time:8/11/2014 7:07:00 AM, Total:3, Min:, Max:, Time:8/11/2014 7:08:00 AM, Total:12, Min:, Max:...} 
$metrics[1].Data.Values | ft 
TimeCreated Total Minimum Maximum Count InstanceName 
----------- ----- ------- ------- ----- ------------ 
8/11/2014 7:05:00 AM 4 1 RD00155DC24599 
8/11/2014 7:06:00 AM 3 1 RD00155DC24599 
8/11/2014 7:07:00 AM 3 1 RD00155DC24589 
8/11/2014 7:08:00 AM 12 1 RD00155DC24599
8/11/2014 7:09:00 AM 37 1 RD00155DC24599 
8/11/2014 7:10:00 AM 9 1 RD00155DC24599

This command gets metrics for the last three hours on a per-instance level for a website.

Parameters

-EndDate

Specifies the time, as a DateTime object, to stop getting metrics. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-InstanceDetails

Indicates that this cmdlet includes details on a per-instance level. If the web hosting plan runs on two or more computers, this cmdlet returns metrics for each computer.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-MetricNames

Specifies an array of metrics to get. If you do not specify this parameter, the cmdlet gets all metrics.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of a website in the subscription. This parameter does not support wildcard characters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Slot

Specifies the environment of a cloud service deployment. Valid values are: Production and Staging.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-SlotView

Indicates that this cmdlet gets metrics for the host names that receive traffic at the current slot. If a swap occurs during the time period, the metrics are merged.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StartDate

Specifies the time, as a DateTime object, to start getting metrics.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-TimeGrain

Specifies the time unit for metrics. Valid values are:

  • PT1M (Minute)
  • PT1H (Hour)
  • P1D (Day)

The default value is PT1H.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

You can pass input to this cmdlet by property name, but not by value.

Outputs

Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.MetricResponse

By default, Get-AzureWebsiteMetric returns an array of MetricResponse objects.