将 Azure 监视器容器添加到仪表板

Adding Azure monitor container into Dashboard

我需要在 Azure 中创建我的仪表板,并且需要将 Azure 监视器容器数据添加或固定到其中。还需要将我的 Kubernes 服务的监控见解添加到我的仪表板中

我是产品组的。您到底想从 Monitoring Insights 获取什么信息?是 CPU/Memory 用法吗?容器性能?如果我们能理解这一点,我们将能够更好地帮助您。

查看此线程:

另外,这里有一个关于集群范围 cpu/memory 利用率的很好的查询:

let endDateTime = now();
let startDateTime = ago(14d);
let trendBinSize = 1d;
let capacityCounterName = 'cpuCapacityNanoCores';
let usageCounterName = 'cpuUsageNanoCores';
KubeNodeInventory
| where TimeGenerated < endDateTime
| where TimeGenerated >= startDateTime
// cluster filter would go here if multiple clusters are reporting to the same Log Analytics workspace
| distinct ClusterName, Computer
| join hint.strategy=shuffle (
    Perf
    | where TimeGenerated < endDateTime
    | where TimeGenerated >= startDateTime
    | where ObjectName == 'K8SNode'
    | where CounterName == capacityCounterName
    | summarize LimitValue = max(CounterValue) by Computer, CounterName, bin(TimeGenerated, trendBinSize)
    | project Computer, CapacityStartTime = TimeGenerated, CapacityEndTime = TimeGenerated + trendBinSize, LimitValue
) on Computer
| join kind=inner hint.strategy=shuffle (
    Perf
    | where TimeGenerated < endDateTime + trendBinSize
    | where TimeGenerated >= startDateTime - trendBinSize
    | where ObjectName == 'K8SNode'
    | where CounterName == usageCounterName
    | project Computer, UsageValue = CounterValue, TimeGenerated
) on Computer
| where TimeGenerated >= CapacityStartTime and TimeGenerated < CapacityEndTime
| project ClusterName, Computer, TimeGenerated, UsagePercent = UsageValue * 100.0 / LimitValue
| summarize Avg = avg(UsagePercent), P95 = percentile(UsagePercent, 95), P90 = percentile(UsagePercent, 90) by bin(TimeGenerated, trendBinSize) 
| render timechart

将指标名称替换为以下内容以创建内存利用率图表:

let capacityCounterName = 'memoryCapacityBytes';
let usageCounterName = 'memoryRssBytes';

如果你想过滤到一个集群,使用它来代替上面查询中的注释:

| where ClusterName == '<my-cluster-name>'

希望这将成为您的仪表板的良好开端...当您探索 Log Analytics 中可用的查询和表以及有关集群的信息时,您会发现很多有用的数据...