Abfragen für die Perf-Tabelle
Informationen zur Verwendung dieser Abfragen im Azure-Portal finden Sie im Log Analytics-Lernprogramm. Informationen zur REST-API finden Sie unter "Abfrage".
Nicht-RDMA-Aktivität
Anzeigen der Nicht-RDMA-Aktivität eines Knotens innerhalb eines Clusters.
//Select your log analytics workspace and replace enter nodename with the name of the node within a cluster on which you want to set the alert for Non-RDMA activity
Perf
| where ObjectName == "Network Interface"
| extend Nodename= tostring(split(Computer, ".")[0])
| where Nodename =~'enter nodename'
| summarize NetworkUsage = sum(CounterValue), Nodename = any(Nodename) by TimeGenerated
| summarize arg_max(TimeGenerated, Nodename, NetworkUsage)
RDMA-Aktivität
Anzeigen der RDMA-Aktivität eines Knotens innerhalb eines Clusters.
//Select log analytics workspace and replace enter nodename with the name of the node within a cluster on which you want to set the alert for RDMA activity
Perf
| where ObjectName == "RDMA Activity"
| extend Nodename= tostring(split(Computer, ".")[0])
| where Nodename =~'enter nodename'
| summarize RdmaUsage = sum(CounterValue), Nodename = any(Nodename) by TimeGenerated
| summarize arg_max(TimeGenerated, Nodename, RdmaUsage)
Welche Daten werden gesammelt?
Auflisten der gesammelten Leistungsindikatoren und Objekttypen (Prozess, Arbeitsspeicher, Prozessor).
Perf
| summarize by ObjectName, CounterName
Arbeitsspeicherauslastung und CPU-Auslastung
Chart all computers used memory and CPU, over the last hour.
Perf
| where TimeGenerated > ago(1h)
| where (CounterName == "% Processor Time" and InstanceName == "_Total") or CounterName == "% Used Memory"
| project TimeGenerated, CounterName, CounterValue
| summarize avg(CounterValue) by CounterName, bin(TimeGenerated, 1m)
| render timechart
CPU-Auslastungstrends über den letzten Tag
Berechnen von CPU-Auslastungsmustern auf allen Computern, Diagramm nach Quantilen.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| summarize percentiles(CounterValue, 50, 90, 99) by bin(TimeGenerated, 1h)
| render timechart
Top 10 Computer mit dem höchsten Speicherplatz
Zeigen Sie die obersten 10 Computer mit dem höchsten verfügbaren Speicherplatz an.
Perf
| where CounterName == "Free Megabytes" and InstanceName == "_Total"
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue
Welche Daten werden gesammelt?
Auflisten der gesammelten Leistungsindikatoren und Objekttypen (Prozess, Arbeitsspeicher, Prozessor...)
Perf
| summarize by ObjectName, CounterName
Verfügbarer Arbeitsspeicher für virtuelle Computer
Stellen Sie den verfügbaren Arbeitsspeicher des virtuellen Computers im zeitlichen Verlauf dar.
// To create an alert for this query, click '+ New alert rule'
Perf
| where ObjectName == "Memory" and
(CounterName == "Available MBytes Memory" or // the name used in Linux records
CounterName == "Available MBytes") // the name used in Windows records
| summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId // bin is used to set the time grain to 15 minutes
| render timechart
CPU-Auslastungstrends darstellen
Berechnen Sie die CPU-Auslastungsmuster des letzten Tages, und stellen Sie sie nach Quantil dar.
// To create an alert for this query, click '+ New alert rule'
Perf
| where CounterName == "% Processor Time"
| where ObjectName == "Processor"
| summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId // bin is used to set the time grain to 15 minutes
| render timechart
// Perf table stores performance counters for Windows and Linux computers
// Counters are specified using ObjectName (performance object), InstanceName and CounterName
// % Processor Time captures CPU activity, ObjectNames can be Processor, Process and Process Information
Freier Speicherplatz auf dem virtuellen Computer
Zeigen Sie den aktuellen Bericht zum freien Speicherplatz pro Instanz an.
// To create an alert for this query, click '+ New alert rule'
Perf
| where ObjectName == "LogicalDisk" or // the object name used in Windows records
ObjectName == "Logical Disk" // the object name used in Linux records
| where CounterName == "Free Megabytes"
| summarize arg_max(TimeGenerated, *) by InstanceName // arg_max over TimeGenerated returns the latest record
| project TimeGenerated, InstanceName, CounterValue, Computer, _ResourceId
Top 10 virtuelle Computer nach CPU-Auslastung
Finden Sie die 10 wichtigsten VM nach CPU-Auslastung in den letzten 7 Tagen.
Perf
| where TimeGenerated > ago(7d)
| where CounterName == "% Processor Time" and InstanceName == "_Total"
| project TimeGenerated, Computer, ObjectName, CounterName, InstanceName, round(CounterValue, 2)
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue
Letzte 10 nach freiem Speicherplatz in %
Untere 10 Freier Speicherplatz % nach Computer, für die letzten 7 Tage.
Perf
| where TimeGenerated > ago(7d)
| where (ObjectName == "Logical Disk" or ObjectName == "LogicalDisk") and CounterName contains "%" and InstanceName != "_Total" and InstanceName != "HarddiskVolume1"
| project TimeGenerated, Computer, ObjectName, CounterName, InstanceName, CounterValue
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue desc
Container-CPU
Zeigen Sie die gesamte CPU-Auslastung des Containers an, die über 30 Minuten gemittelt ist.
// To create an alert for this query, click '+ New alert rule'
//Select the Line chart display option: can we calculate percentage?
Perf
| where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
| summarize AvgCPUUsageNanoCores = avg(CounterValue) by bin(TimeGenerated, 30m), InstanceName, _ResourceId
Containerspeicher
Anzeigen der Container-CPU über 30 Minuten Intervalle.
// To create an alert for this query, click '+ New alert rule'
//Select the Line chart display option: can we calculate percentage?
let threshold = 75000000; // choose a threshold
Perf
| where ObjectName == "K8SContainer" and CounterName == "memoryRssBytes"
| summarize AvgUsedRssMemoryBytes = avg(CounterValue) by bin(TimeGenerated, 30m), InstanceName, _ResourceId
| where AvgUsedRssMemoryBytes > threshold
| render timechart
Instanzen Avg CPU Usage Growth from last week
Zeigen Sie das durchschnittliche CPU-Wachstum nach Instanz in der letzten Woche nach absteigender Reihenfolge an.
// To create an alert for this query, click '+ New alert rule'
//Show which instances grew CPU usage from last week to current
Perf
| where TimeGenerated > ago(7d) //This week Average CPU Usage Nano Cores
| where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
| summarize ThisWeekAvgCPU = avg(CounterValue) by InstanceName, _ResourceId
| join kind= leftouter (
//Previous week Average CPU Usage Nano Cores
Perf
| where TimeGenerated > ago(14d) and TimeGenerated <= ago(7d)
| where ObjectName == "K8SContainer" and CounterName == "cpuUsageNanoCores"
| summarize PrevWeekAvgCPU = avg(CounterValue) by InstanceName, _ResourceId
) on InstanceName, _ResourceId
| extend InstanceNameParts = split(InstanceName, "/") //array of the parts of the instance name
| extend ShortInstanceName = InstanceNameParts[(array_length(InstanceNameParts)-1)] //extract the last part of the instance name
| extend ThisWeekAvgCPU = round(ThisWeekAvgCPU,0)
| extend PrevWeekAvgCPU = round(iff(isempty(PrevWeekAvgCPU),0.0,PrevWeekAvgCPU),0) //When doing join with kind=leftouter, missing matches has empty value. To calculate growth, it should be converted to zero. In this case, empty value means that instance did not exist in the previous week
| extend AvgCPUGrowth = round(ThisWeekAvgCPU - PrevWeekAvgCPU , 0) //Calculate growth
| project-away InstanceName1,InstanceNameParts //Remove redundant fields
| order by AvgCPUGrowth desc
Suchen in Perf
Suchen Sie in Perf nach einem bestimmten Wert in der Perf-Tabelle./nNote, dass für diese Abfrage eine Aktualisierung des <SeachValue-Parameters> erforderlich ist, um Ergebnisse zu erzielen.
// This query requires a parameter to run. Enter value in SearchValue to find in table.
let SearchValue = "<SearchValue>";//Please update term you would like to find in the table.
Perf
| where * contains tostring(SearchValue)
| take 1000