Is there a KQL Query to detect Session hosts that are in drain mode (not accepting new sessions)?

%3CLINGO-SUB%20id%3D%22lingo-sub-2421503%22%20slang%3D%22en-US%22%3EIs%20there%20a%20KQL%20Query%20to%20detect%20Session%20hosts%20that%20are%20in%20drain%20mode%20(not%20accepting%20new%20sessions)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2421503%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20setup%20an%20Azure%20function%20to%20lookout%20for%20problem%20WVD%20session%20hosts%20(VMs%20running%20for%20more%20that%2015%20mins%20but%20not%20available%20in%20the%20host%20pool)%2C%20which%20then%20shuts%20them%20down%20and%20sets%20Drain%20mode%20on.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20now%20want%20to%20create%20a%20Logic%20App%20that%20would%20check%20for%20Session%20hosts%20with%20Drain%20mode%20on%20and%20then%20email%20me%20if%20any%20are%20found%20(so%20that%20I%20can%20be%20warned%20of%20potentially%20problematic%20session%20hosts).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%2C%20I%20don't%20seem%20to%20be%20able%20to%20find%20the%20Drain%20Mode%20%2F%20Allow%20New%20Sessions%20value%20in%20any%20of%20the%20WVD%20KQL%20tables%20-%20am%20I%20missing%20something%20here%3F%20How%20can%20I%20check%20for%20this%20Session%20host%20status%20in%20a%20logic%20app%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EGary%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2421953%22%20slang%3D%22en-US%22%3ERe%3A%20Is%20there%20a%20KQL%20Query%20to%20detect%20Session%20hosts%20that%20are%20in%20drain%20mode%20(not%20accepting%20new%20sessions)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2421953%22%20slang%3D%22en-US%22%3ECheck%20out%20the%20logic%20we%20going%20to%20use%20to%20update%20%3CA%20href%3D%22https%3A%2F%2Fv-desktops.com%2F2021%2F02%2F17%2Fa-simple-health-check-inventory-dashboard-for-wvd-arm%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fv-desktops.com%2F2021%2F02%2F17%2Fa-simple-health-check-inventory-dashboard-for-wvd-arm%2F%3C%2FA%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2FDavidTaig%2Fstatus%2F1401381330806444032%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftwitter.com%2FDavidTaig%2Fstatus%2F1401381330806444032%3C%2FA%3E%3CBR%20%2F%3EWe%20will%20have%20an%20email%20alert%20for%20Errors%20and%20Warnings%3C%2FLINGO-BODY%3E
Contributor

Hi,

 

I have setup an Azure function to lookout for problem WVD session hosts (VMs running for more that 15 mins but not available in the host pool), which then shuts them down and sets Drain mode on.

 

I now want to create a Logic App that would check for Session hosts with Drain mode on and then email me if any are found (so that I can be warned of potentially problematic session hosts).

 

But, I don't seem to be able to find the Drain Mode / Allow New Sessions value in any of the WVD KQL tables - am I missing something here? How can I check for this Session host status in a logic app?

 

Thanks

Gary

 

3 Replies
Thanks, but that does not really help me...

It seems (I may be wrong?) that Azure Logic Apps can't run Powershell to get the Drain mode state of session hosts in a Host Pool. So, it seems that Logic Apps are more easily created to run a KQL query and then email the results based on some logic.

Unfortunately, I don't think I can get the Drain Mode / Allow New Sessions value via a KQL query, so wondered if:

1) I am missing the value, and it is actually there, or can be obtained via a KQL Query
2) If not, is there some other way that I can get the info and use it in a Logic App.

I don't believe there is a way to check if a Host is in Drain mode

For Allow New Sessions we are running PowerShell with Automation to get those details and more..

 

#AVD Host Status#AVD Host Status