cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need filter for labels in Metric Event Query

kyadav
Newcomer

We are creating a Metric Event which takes in a query and compares its output with a threshold to make an alerting decision.

Now the issue is that in this specific case where we want to check the number of nodes with a specific label, the Metric Event query isn't giving us an option to sort it based on labels like it used to have in Log Analytics.
(We need to target specific nodes with a custom label)

This is the Log Analytics query (this is what we used to use earlier):

 

 let endDateTime = now(); let startDateTime = ago(1h); KubeNodeInventory |

    where TimeGenerated < endDateTime | where TimeGenerated >= startDateTime | where Status == 'Ready'|

    extend label = todynamic(Labels)|mv-expand label | where tostring(label.agentpool) == "system"| distinct Computer

 

and this the query that we currently have in DT :

 

builtin:kubernetes.nodes

:filter(and(or(eq("k8s.cluster.name",<cluster-name>))))

:splitBy("k8s.cluster.name")

 

The problem is that it the query doesn't let us leverage the labels of nodes.

0 REPLIES 0

Featured Posts