Unable to create an Metric measurement alert on AKS Node Network Workbook queries

Occasional Visitor

I am trying to create a metric measurement alert on Total Bytes Sent (by 10m intervals) metric available in Node Network Workbook on AKS cluster. I have retrieved its query and when i am running it on Log Analytics Workspace, its running fine. Query is listed below

Go to Log Analytics and run query

let bytesSentTotal = InsightsMetrics
| where Origin == 'container.azm.ms/telegraf'
| where Namespace == 'container.azm.ms/net'
| where Name == 'bytes_sent'
| extend Tags = todynamic(Tags)
| extend ClusterId = tostring(Tags['container.azm.ms/clusterId']), HostName = tostring(Tags.hostName), Interface = tostring(Tags.interface)
| where "a" == "a"
| where '*' in ('*') or HostName in ('*')
| where '*' in ('eth0') or Interface in ('eth0')
| extend partitionKey = strcat(HostName, '/', Interface)
| order by partitionKey asc, TimeGenerated asc
| serialize
| extend PrevVal = iif(prev(partitionKey) != partitionKey, 0.0, prev(Val)), PrevTimeGenerated = iif(prev(partitionKey) != partitionKey, datetime(null), prev(TimeGenerated))
| where isnotnull(PrevTimeGenerated) and PrevTimeGenerated != TimeGenerated
| extend Rate = iif(PrevVal > Val, Val / 1, (Val - PrevVal) / 1)
| where isnotnull(Rate)
| project TimeGenerated, HostName, Interface, Rate;
bytesSentTotal
| make-series Val = sum(Rate) default = 0 on TimeGenerated from ago(21600000ms) to now() step 10m by HostName, Interface
| extend Name = strcat(HostName, '/', Interface)
| project-away HostName, Interface

 

But when trying to create a custom query alert based on metric measurement using same query provided by Workbook i am getting error 

"Search Query should contain 'AggregatedValue' and 'bin(TimeGenerated, [roundTo])' for Metric alert type"

So when i am trying to add below mentioned line in my query. 

| summarize AggregatedValue = count() by Val, bin(TimeGenerated, 15m)

 

Error:  "bin(): argument #1 - invalid data type: dynamic If issue persists, please open a support ticket. Request id: 0fb04456-42b7-43c2-9512-1af3460610fc"

 

I am not getting how to solve this. Actually i want an alert to trigger whenever my Total Bytes Sent are greater than 100mb. 
Need help urgently.

0 Replies