Tillämpa Microsoft Azure-diagnostiktillägget i Cloud Services (utökad support)
Du kan övervaka viktiga prestandamått för alla molntjänster. Varje molntjänstroll samlar in minimala data: CPU-användning, nätverksanvändning och diskanvändning. Om molntjänsten har tillägget Microsoft.Azure.Diagnostics tillämpat på en roll kan den rollen samla in fler datapunkter. Mer information finns i Översikt över tillägg
Microsoft Azure Diagnostics-tillägget kan aktiveras för Cloud Services (utökad support) via PowerShell eller ARM-mall
Använda Microsoft Azure Diagnostics-tillägget med Hjälp av PowerShell
# Create WAD extension object
$storageAccountKey = Get-AzStorageAccountKey -ResourceGroupName "ContosOrg" -Name "contosostorageaccount"
$configFilePath = "<Insert WAD public configuration file path>"
$wadExtension = New-AzCloudServiceDiagnosticsExtension -Name "WADExtension" -ResourceGroupName "ContosOrg" -CloudServiceName "ContosoCS" -StorageAccountName "contosostorageaccount" -StorageAccountKey $storageAccountKey[0].Value -DiagnosticsConfigurationPath $configFilePath -TypeHandlerVersion "1.5" -AutoUpgradeMinorVersion $true
# Add <privateConfig> settings
$wadExtension.ProtectedSetting = "<Insert WAD Private Configuration as raw string here>"
# Get existing Cloud Service
$cloudService = Get-AzCloudService -ResourceGroup "ContosOrg" -CloudServiceName "ContosoCS"
# Add WAD extension to existing Cloud Service extension object
$cloudService.ExtensionProfile.Extension = $cloudService.ExtensionProfile.Extension + $wadExtension
# Update Cloud Service
$cloudService | Update-AzCloudService
Ladda ned den offentliga konfigurationsfilens schemadefinition genom att köra följande PowerShell-kommando:
(Get-AzureServiceAvailableExtension -ExtensionName 'PaaSDiagnostics' -ProviderNamespace 'Microsoft.Azure.Diagnostics').PublicConfigurationSchema | Out-File -Encoding utf8 -FilePath 'PublicWadConfig.xsd'
Här är ett exempel på XML-filen för offentlig konfiguration
<?xml version="1.0" encoding="utf-8"?>
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
<DiagnosticMonitorConfiguration overallQuotaInMB="25000">
<PerformanceCounters scheduledTransferPeriod="PT1M">
<PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT1M" unit="percent" />
<PerformanceCounterConfiguration counterSpecifier="\Memory\Committed Bytes" sampleRate="PT1M" unit="bytes"/>
</PerformanceCounters>
<EtwProviders>
<EtwEventSourceProviderConfiguration provider="SampleEventSourceWriter" scheduledTransferPeriod="PT5M">
<Event id="1" eventDestination="EnumsTable"/>
<DefaultEvents eventDestination="DefaultTable" />
</EtwEventSourceProviderConfiguration>
</EtwProviders>
</DiagnosticMonitorConfiguration>
</WadCfg>
</PublicConfig>
Ladda ned schemadefinitionen för den privata konfigurationsfilen genom att köra följande PowerShell-kommando:
(Get-AzureServiceAvailableExtension -ExtensionName 'PaaSDiagnostics' -ProviderNamespace 'Microsoft.Azure.Diagnostics').PrivateConfigurationSchema | Out-File -Encoding utf8 -FilePath 'PrivateWadConfig.xsd'
Här är ett exempel på XML-filen för privat konfiguration
<?xml version="1.0" encoding="utf-8"?>
<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="string" key="string" />
<AzureMonitorAccount>
<ServicePrincipalMeta>
<PrincipalId>string</PrincipalId>
<Secret>string</Secret>
</ServicePrincipalMeta>
</AzureMonitorAccount>
<SecondaryStorageAccounts>
<StorageAccount name="string" />
</SecondaryStorageAccounts>
<SecondaryEventHubs>
<EventHub Url="string" SharedAccessKeyName="string" SharedAccessKey="string" />
</SecondaryEventHubs>
</PrivateConfig>
Använda Microsoft Azure Diagnostics-tillägget med hjälp av ARM-mallen
"extensionProfile": {
"extensions": [
{
"name": "Microsoft.Insights.VMDiagnosticsSettings_WebRole1",
"properties": {
"autoUpgradeMinorVersion": true,
"publisher": "Microsoft.Azure.Diagnostics",
"type": "PaaSDiagnostics",
"typeHandlerVersion": "1.5",
"settings": "Include PublicConfig XML as a raw string",
"protectedSettings": "Include PrivateConfig XML as a raw string”",
"rolesAppliedTo": [
"WebRole1"
]
}
}
]
},
Nästa steg
- Granska distributionskraven för Cloud Services (utökad support).
- Granska vanliga frågor och svar om Cloud Services (utökad support).
- Distribuera en molntjänst (utökad support) med hjälp av Azure Portal, PowerShell, mall eller Visual Studio.