问题
Is there a way to added performance counter in Azure Log Analytics using Powershell or azure CLI. The only options I see are for querying.
回答1:
According to my research, we can use PowerShell command new-azoperationalinsightswindowsperformancecounterdatasource
to add windows performance counter. For more details, please refer to the document.
For example
Connect-AzAccount
$workspace=Get-AzOperationalInsightsWorkspace -ResourceGroupName jimtest -Name hybridWorkspace32979
New-AzOperationalInsightsWindowsPerformanceCounterDataSource -Workspace $workspace -Name "test" -ObjectName ".NET CLR Loading" -CounterName "Total Appdomains" -InstanceName "*" -IntervalSeconds 10
Get-AzOperationalInsightsDataSource -ResourceGroupName jimtest -WorkspaceName hybridWorkspace32979 -Kind WindowsPerformanceCounter
Besides, if you want to add Linux performance counter, you can use the command New-AzOperationalInsightsLinuxPerformanceObjectDataSource
and Enable-AzOperationalInsightsLinuxPerformanceCollection
. For more details, please refer to the article
来源:https://stackoverflow.com/questions/60302331/is-there-a-way-to-add-performance-counter-in-azure-log-analytics-from-command-li