Requêtes pour la table Perf
Pour plus d’informations sur l’utilisation de ces requêtes dans le Portail Azure, consultez le didacticiel Log Analytics. Pour l’API REST, consultez Requête.
Activité non RDMA
Afficher l’activité non RDMA d’un nœud au sein d’un cluster.
//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)
Activité RDMA
Affichez l’activité RDMA d’un nœud au sein d’un cluster.
//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)
Quelles données sont collectées ?
Répertorier les compteurs de performances collectés et les types d’objets (Processus, Mémoire, Processeur).
Perf
| summarize by ObjectName, CounterName
Utilisation de la mémoire et du processeur
Graphiquer la mémoire et le processeur utilisés par tous les ordinateurs au cours de la dernière heure.
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
Tendances de l’utilisation du processeur au cours du dernier jour
Calculez les modèles d’utilisation du processeur sur tous les ordinateurs, graphique par centiles.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| summarize percentiles(CounterValue, 50, 90, 99) by bin(TimeGenerated, 1h)
| render timechart
10 premiers ordinateurs disposant de l’espace disque le plus élevé
Affichez les 10 premiers ordinateurs avec l’espace disque disponible le plus élevé.
Perf
| where CounterName == "Free Megabytes" and InstanceName == "_Total"
| summarize arg_max(TimeGenerated, *) by Computer
| top 10 by CounterValue
Quelles données sont collectées ?
Répertorier les compteurs de performances collectés et les types d’objets (Processus, Mémoire, Processeur...)
Perf
| summarize by ObjectName, CounterName
Mémoire disponible de la machine virtuelle
Graphique de la mémoire disponible de la machine virtuelle au fil du temps.
// 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
Graphique des tendances d’utilisation du processeur
Calculer les modèles d’utilisation du processeur au cours de la dernière journée, produire un graphique par centiles.
// 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
Espace disque disponible de la machine virtuelle
Afficher le rapport le plus récent de l’espace disque libre, par instance.
// 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
10 premières machines virtuelles par utilisation du processeur
Recherchez les 10 principales machines virtuelles par utilisation du processeur au cours des 7 derniers jours.
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
10 derniers espaces disque libres en %
Espace disque libre de 10 % inférieur par ordinateur, au cours des 7 derniers jours.
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
Processeur du conteneur
Affichez l’utilisation moyenne du processeur du conteneur sur plus de 30 minutes.
// 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
Mémoire du conteneur
Affichez la moyenne du processeur du conteneur sur plus de 30 minutes.
// 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
Croissance moyenne de l’utilisation du processeur des instances de la semaine dernière
Afficher la croissance moyenne de l’UC par instance dans la semaine dernière en ordre décroissant.
// 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
Rechercher dans Perf
Recherchez dans Perf pour rechercher une valeur spécifique dans la table Perf./nNote que cette requête nécessite de mettre à jour le <paramètre SeachValue> pour produire des résultats
// 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