2

In Azure dashboards, is there any way we can trigger alerts based on percentage instead of counts?.. Example if total total failures in 20 minutes is 20%, then trigger alert than just cheking the counts of the failures? Here setting the count is not meeting our requirement and looking a solution based on the Percentage of occurance.

Vowneee
  • 956
  • 10
  • 33

1 Answers1

1

Based on the above shared requirement , we have created the custom Kusto query to calculate the percentage of failure requests & to trigger an email alert notification if the failure requests percentage > 20% for a particular web app & also projecting the output of the Kusto query to the dashboard as well.

Here is the custom Kusto query :

requests
| where timestamp >= ago(6h)
| project success, ['id'], resultCode, appName
| summarize failedtotal = countif(success == 'False'), total= count()
| project  failurepercentage = (100 * (failedtotal) / (total))
| summarize totalouputrows=countif(failurepercentage>20) by failurepercentage

Use the New alert rule option in the log analytics space to create a custom alert & using the above query as signal as shown in below picture.

enter image description here

Use the Pin to dashboard option in the log analytics work space to project the output of the custom Kusto query & create the dashboard accordingly.

enter image description here

Here is the sample image of the alert rule that was created using the above query.

enter image description here

Here is the sample email output & Kusto query output projected to dashboard triggered by above alert rule.

enter image description here

VenkateshDodda
  • 4,723
  • 1
  • 3
  • 12
  • need some clarification on the last part of the query.. Because in my scenario I used below query to get the percentage. – Vowneee Oct 02 '21 at 02:02
  • AppDependencies |where AppRoleName == "my-app" | Data contains "myname" | summarize failedtotal = countif(Success == 'False'), total= count() | project failurepercentage = (100 * (failedtotal) / (total)) | summarize totalouputrows=countif(failurepercentage>0) by failurepercentage – Vowneee Oct 02 '21 at 02:02
  • the total request received was 23415, where failed was 276. so that about 1.1%, and resulted the failure percentaage as 1% ( not sure why its excluded the decimal value) – Vowneee Oct 02 '21 at 02:04
  • so here , whats the totalouputrows stands for, and i got again 1 as output when i put the failrepercentage >0, – Vowneee Oct 02 '21 at 02:06