Creating an azure monitor alert from log analytics with scalar values

Brass Contributor

I want to create an alert based on a specific counter not increasing.  ie in the query below, I want to be able to create an alert if m1-m2 is ever zero.  ie the counter I'm recording in Log Analytics does not increase over time.

 

Any thoughts on how I might do this?

 

let m1 = toscalar(customMonitoring_CL
| where nodeName_s == 'test1'
| where TimeGenerated between(ago(5m)..now())
| top 1 by nodeName_s
| project counter_d);
let m2 = toscalar(customMonitoring_CL
| where nodeName_s == 'test2'
| where TimeGenerated between(ago(10m)..ago(5m))
| top 1 by nodeName_s
| project counter_d);
print m1-m2

0 Replies