Skip to content

Commit 1c73fa9

Browse files
committed
new perf example
1 parent adfd405 commit 1c73fa9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Log Analytics.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
### Perf
3535
##### [Correlate computer memory and CPU](~/examples/Log Analytics/Correlate computer memory and cpu.md)
3636
##### [Perf CPU Utilization graph per computer](~/examples/Log Analytics/Perf CPU Utilization graph per computer.md)
37+
##### [Calculate computer availability rate](~/examples/Log Analytics/Calculate computer availability rate.md)
3738

3839
### Alert
3940
##### [Count alerts by severity per day](~/examples/Log Analytics/Count and chart alerts severity per day.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Calculate computer availability rate
2+
#### #bin_at #countif #hourofday
3+
<!-- article_id: 1601‎201803827040 -->
4+
5+
For each computer, calculate the availability rate calculated since midnight. Availability is defined as "at least 1 heartbeat per hour".
6+
7+
```OQL
8+
let midnight=startofday(now());
9+
Heartbeat
10+
| where TimeGenerated>midnight
11+
| summarize heartbeat_per_hour=count() by bin_at(TimeGenerated, 1h, midnight), Computer
12+
| extend available_per_hour=iff(heartbeat_per_hour>0, true, false)
13+
| summarize total_available_hours=countif(available_per_hour==true) by Computer
14+
| extend number_of_buckets=hourofday(now())+1
15+
| extend availability_rate=total_available_hours*100/number_of_buckets
16+
```

0 commit comments

Comments
 (0)