Jan 31 2024 04:05 AM
Hi,
I am new to Azure monitor and reporting. I have written a KQL query to sum-up a daily uptime for AVD session hosts. When this query runs
1: It is not rounding the availability column.
2: How can I set a start time and end time fixed for a day (12AM till 11:59 pm)
3: I need to automate this daily run and email this report
Could you please give me any guidance on this. I give the screen shot below
Thanks
Arumai
Jan 31 2024 09:25 AM
Feb 02 2024 05:09 AM
I am trying to extract last month report but it is erroring. Is the query structure for the last month is OK? Could you please look at this. Thanks in advance.
//Heartbeat
| where TimeGenerated between (startofmonth(ago(1m))) .. endofmonth(ago(1m)))
| summarize min(TimeGenerated), max(TimeGenerated)
//| summarize heartbeat_per_hour=count() by bin_at(TimeGenerated, 1h, start_time), Computer
| extend available_per_hour=iff(heartbeat_per_hour > 0, true, false)
| summarize Available_Hours=countif(available_per_hour == true) by Computer
| extend Total_Hours=round((max(TimeGenerated) - min(TimeGenerated) / 1h)
| extend Availability_Percentage=Available_Hours * 100 / Total_Hours
| project
Computer,
Total_Hours,
Available_Hours,
round(Availability_Percentage, 0)
Feb 02 2024 05:29 AM
The month part is solved with this:
Heartbeat
| where TimeGenerated between ( startofmonth(now(),-1).. endofmonth(now(),-1) )
| summarize heartbeat_per_hour=count() by bin(TimeGenerated, 1h), Computer
| extend available_per_hour=iff(heartbeat_per_hour > 0, true, false)
Please take a look at my article about time, for other examples: How to align your Analytics with time windows in Azure Sentinel using KQL (Kusto Query Language) - M...
Feb 02 2024 06:35 AM