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

时间:2019-02-01 10:26:39

标签: azure kubernetes azure-monitoring

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

2 个答案:

答案 0 :(得分:0)

我来自产品团队。您到底想从Monitoring Insights锁定什么?是CPU /内存使用率吗?容器性能?如果我们能够理解,我们将能够为您提供更好的帮助。

答案 1 :(得分:0)

检查此线程:Azure AKS Monitoring - custom dashboard resources

此外,这是一个有关集群范围的cpu /内存利用率的好查询:

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中使用集群上的信息探索查询和表,您会发现很多有用的数据...