Edit

Share via


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

Default (Default)

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.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-MetricNames

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Slot

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StartDate

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

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TimeGrain

Specifies the time unit for metrics. Valid values are:

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

The default value is PT1H.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

undefined

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.