Abfragen für die InsightsMetrics-Tabelle
Informationen zur Verwendung dieser Abfragen im Azure-Portal finden Sie im Log Analytics-Lernprogramm. Informationen zur REST-API finden Sie unter "Abfrage".
IoT Edge: Gerät offline oder nicht senden Nachrichten upstream mit erwarteter Rate
Identifizieren Sie IoT Edge-Geräte, die in den letzten 2 Tagen nicht D2C-Nachrichten während eines Zeitraums von 30 Minuten an IoT Hub senden.
// To create an alert for this query, click '+ New alert rule'
let targetReceiver = "upstream";
InsightsMetrics
| where Origin == "iot.azm.ms" and Namespace == "metricsmodule"
| where Name == "edgehub_messages_sent_total"
| extend dimensions=parse_json(Tags)
| extend device = tostring(dimensions.edge_device)
| extend target = trim_start(@"[^/]+/", extractjson("$.to",
tostring(dimensions), typeof(string)))
| where target contains targetReceiver
| extend source = strcat(device, "::", trim_start(@"[^/]+/",
tostring(dimensions.from)))
| extend messages = toint(Val)
| extend timeUtc = TimeGenerated
| extend sourceTarget = strcat(source, "::", target)
| project timeUtc, source, sourceTarget, messages, device, _ResourceId
| order by device, sourceTarget, timeUtc
| serialize
| extend nextCount = next(messages, 1)
| extend nextSourceTarget= next(sourceTarget, 1)
| extend diff = iff((messages - nextCount) >= 0, messages - nextCount, 0)
| where sourceTarget == nextSourceTarget and diff >= 0
| project TimeGenerated = timeUtc, source, sourceTarget, messages, diff,
device, _ResourceId
| make-series sum(diff) default=0 on TimeGenerated from ago(2d) to now()
step 30m by device, _ResourceId
| mv-expand sum_diff, TimeGenerated
| project TimeGenerated=todatetime(TimeGenerated), device,
AggregatedValue=toint(sum_diff), _ResourceId
IoT Edge: Edge Hub-Warteschlangengröße über dem Schwellenwert
Häufigkeit, mit der die Edge Hub-Warteschlangengröße (Summe) eines Geräts während des Auswertungszeitraums über dem konfigurierten Schwellenwert lag.
// To create an alert for this query, click '+ New alert'
let qlenThreshold = 100;
InsightsMetrics
| where Origin == "iot.azm.ms" and Namespace == "metricsmodule"
| where Name == "edgehub_queue_length"
| extend dimensions=parse_json(Tags)
| extend device = tostring(dimensions.edge_device)
| extend ep = tostring(dimensions.endpoint)
| extend qlen = toint(Val)
| project device, qlen, ep, TimeGenerated, _ResourceId
| summarize sum(qlen) by TimeGenerated, device, _ResourceId
| where sum_qlen >= qlenThreshold
| project-away sum_qlen
Maximaler Knotendatenträger
Die maximale Datenträgerauslastung von Knoten beträgt durchschnittlich 30 Minuten.
// To create an alert for this query, click '+ New alert rule'
//InsightMetrics contains all the custom metrics for Container Insights solution
InsightsMetrics // Replace Name with your custom metric
| where Name == "used_percent" and Namespace == "container.azm.ms/disk"
| summarize val= max(Val) by bin(TimeGenerated, 15m), _ResourceId
| render timechart
Prometheus-Datenträger pro Sekunde pro Knoten gelesen
Anzeigen von Prometheus-Datenträgerlesemetriken aus dem Standard-Kubernetes-Namespace als Zeitdiagramm.
// To create an alert for this query, click '+ New alert rule'
// Update TimeGenerated field for custom time range
InsightsMetrics
| where Namespace == 'container.azm.ms/diskio'
| where TimeGenerated > ago(1h)
| where Name == 'reads'
| extend Tags = todynamic(Tags)
| extend HostName = tostring(Tags.hostName), Device = Tags.name
| extend NodeDisk = strcat(Device, "/", HostName)
| order by NodeDisk asc, TimeGenerated asc
| serialize //calculating the PreVal, PrevTimeGenerated to render the chart.
| extend PrevVal = iif(prev(NodeDisk) != NodeDisk, 0.0, prev(Val)), PrevTimeGenerated = iif(prev(NodeDisk) != NodeDisk, datetime(null), prev(TimeGenerated))
| where isnotnull(PrevTimeGenerated) and PrevTimeGenerated != TimeGenerated
//Calculating the rate for disk using PreVal
| extend Rate = iif(PrevVal > Val, Val / (datetime_diff('Second', TimeGenerated, PrevTimeGenerated) * 1), iif(PrevVal == Val, 0.0, (Val - PrevVal) / (datetime_diff('Second', TimeGenerated, PrevTimeGenerated) * 1)))
| where isnotnull(Rate)
| project TimeGenerated, NodeDisk, Rate, _ResourceId
| render timechart
In InsightsMetrics suchen
Suchen Sie in InsightsMetrics, um nach einem bestimmten Wert in der InsightsMetrics-Tabelle zu suchen./nNote, dass diese Abfrage das Aktualisieren des <SeachValue-Parameters> erfordert, 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.
InsightsMetrics
| where * contains tostring(SearchValue)
| take 1000
Welche Daten werden gesammelt?
Listen Sie die gesammelten Leistungsindikatoren und
InsightsMetrics
| where Origin == "vm.azm.ms"
| summarize by Namespace, Name
Verfügbarer Arbeitsspeicher für virtuelle Computer
Verfügbarer Arbeitsspeicher für virtuelle Computer.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Origin == "vm.azm.ms"
| where Namespace == "Memory"
| where Name == "AvailableMB"
| summarize avg(Val) by bin(TimeGenerated, 5m), Computer
| render timechart
CPU-Auslastungstrends nach Computer darstellen
Berechnen Sie die CPU-Auslastungsmuster in der letzten Stunde, und stellen Sie sie nach Quantil dar.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Origin == "vm.azm.ms"
| where Namespace == "Processor"
| where Name == "UtilizationPercentage"
| summarize avg(Val) by bin(TimeGenerated, 5m), Computer //split up by computer
| render timechart
Freier Speicherplatz auf dem virtuellen Computer
Zeigen Sie den aktuellen Bericht zum freien Speicherplatz pro Instanz an.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Origin == "vm.azm.ms"
| where Namespace == "LogicalDisk"
| where Name == "FreeSpaceMB"
| extend t=parse_json(Tags)
| summarize arg_max(TimeGenerated, *) by tostring(t["vm.azm.ms/mountId"]), Computer // arg_max over TimeGenerated returns the latest record
| project Computer, TimeGenerated, t["vm.azm.ms/mountId"], Val
Nachverfolgen der VM-Verfügbarkeit mithilfe des Takts
Zeigen Sie die gemeldete Verfügbarkeit des virtuellen Computers während der letzten Stunde an.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Origin == "vm.azm.ms"
| where Namespace == "Computer"
| where Name == "Heartbeat"
| summarize heartbeat_count = count() by bin(TimeGenerated, 5m), Computer
| extend alive=iff(heartbeat_count > 2, 1.0, 0.0) //computer considered "down" if it has 2 or fewer heartbeats in 5 min interval
| project TimeGenerated, alive, Computer
| render timechart with (ymin = 0, ymax = 1)
Top 10 virtuelle Computer nach CPU-Auslastung
Top 10 virtuelle Computer nach CPU-Auslastung.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Origin == "vm.azm.ms"
| where Namespace == "Processor" and Name == "UtilizationPercentage"
| summarize P90 = percentile(Val, 90) by Computer
| top 10 by P90
Letzte 10 nach freiem Speicherplatz in %
Freier Speicherplatz im unteren Zehnerbereich (%) nach Computer
InsightsMetrics
| where TimeGenerated > ago(24h)
| where Origin == "vm.azm.ms"
| where Namespace == "LogicalDisk" and Name == "FreeSpacePercentage"
| summarize P90 = percentile(Val, 90) by Computer
| top 10 by P90 asc