Изменить существующий kql - PullRequest
       58

Изменить существующий kql

0 голосов
/ 05 августа 2020

Не могли бы вы взглянуть на мой запрос ниже и попытаться помочь мне с этим

// please add a list of your servers here, these ones are the ones that are *shutdown* overnight
let shutdownComputers = dynamic(["machines"]);
// always exclude these computers
let excludeComputers = dynamic(["machines"]);
// config the hours to exclude
let startHour = 1900; // 07:00 PM
let endHour = 06; // 06:00 Am
Heartbeat
// Get just the excluded Servers
| where TimeGenerated > startofday(ago(24h))
| where Computer in (shutdownComputers)
| summarize LastCall = arg_max( TimeGenerated, datetime_part("hour", TimeGenerated) between( startHour .. endHour) )
by Computer, sComputer = strcat("Computer goes offline between ", startHour," to ", endHour," :",Computer), ComputerEnvironment
| where isnotempty(LastCall)
| project Computer , LastCall, sComputer
// Now join those excluded servers with the others...
| join kind= fullouter
(
Heartbeat
| where TimeGenerated > startofday(ago(24h))
| where Computer !in (shutdownComputers) and Computer !in(excludeComputers)
| summarize LastCall = arg_max(TimeGenerated,*) by Computer
) on Computer
// This bit can probably be improved if I get time
| extend Computer = iif(isempty(Computer),Computer1,Computer),
LastCall = iif(isempty(LastCall),LastCall1,LastCall)
| summarize by LastCall, Computer, sComputer
| where LastCall < ago(10m)

Azure Предупреждение пульса виртуальной машины не работает, как показано на снимке экрана ниже. * Есть некоторые машины, о которых не сообщается.

Первая машина из примера net -ovuat2 остановлена, и я получаю предупреждение, вторая машина NET -P2PTESTAPP1. Я попросил не сообщать о машине в определенный период, начиная с 19:00, но для этого не было предупреждений, так как машина выключена до 19:00.

введите описание изображения здесь

...