How to monitor the average value over a certain period

Oetze van den Broek 156 Reputation points
2025-12-12T11:34:21.0066667+00:00

We have devices reporting a voltage level each hour. we need a way to monitor the voltage levels and generate alert when a average value is below a certain threshold. We would like to use the Azure Monitor for this.

I've setup a log analytics workspace with all our data. I've transformed the data into 3 colums:

TimeGenerated DeviceId Voltage
1 am dev1 13.2
2 am dev1 13.4
3 am dev1 13.3
1 am dev2 13.4
2 am dev2 13.5
3 am dev2 13.7

the table is simplied.

How can i take the average value per deviceid of the last 24 hours. The value needs to be evaluated each hour.

I've added this to my KQL as last step:

| summarize 
    AverageVoltage = avg(todouble(Voltage)),
    PointCount = count()
    by tostring(deviceId)

This summerizes the average value per deviceId. But i don't know how the time range of 24h should be applied.

The question is:

  • Should i summerize the value in the kql value?
  • What should be the values of the Alert rule.
    • What should Aggregation granularity be?
    • What should Aggregation type be?
    • What should i set the Override query time range in the advanced section be?

I tried the summerize in kql option. But i don't see any option to take the average of the last 24 hours. in the query editor i can set the time range to be 24 hours. but i don't see this option in the alert rule configuration.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.