question

tegroup-mschlarb avatar image
0 Votes"
tegroup-mschlarb asked ·

Failed guest OS does not trigger any action

A failing guest OS (eg. kernel panic) does not trigger any action. I know from Hyper-V that you could monitor the guest OS heartbeat and define an action when heartbeat is lost. Is there any possibility in Azure to restart a frozen VM? Other cloud providers will restart the VM when it is not responsive...

azure-virtual-machines
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I reached out to the internal teams to get info about this question. I will update here once i have some information.

0 Votes 0 · ·

Hi, did you tried to restart the machine using PowerShell? If yes, then what is the exact error you get

0 Votes 0 · ·

I have not deep dived in this, but if I remember correctly this can be performed by Azure Monitor & an automation runbook. I googled quickly and you can probably use this for reference.

https://blogs.technet.microsoft.com/systemcenterpt/2018/03/21/heartbeat-metric-alerts-for-log-analytics/

1 Vote 1 · ·

I already searched for stuff like this. Thing is, there's no "Heartbeat" metric (step 5 in your guide) when I select a VM (guest OS doesn't matter in this case). Probably you need Operations Management Suite for this, but I'm searching for something Azure native.

0 Votes 0 · ·
Iwanvandewetering avatar image
0 Votes"
Iwanvandewetering answered ·

Restart-AzureRmVM -ResourceGroupName "ResourceGroup" -Name "VirtualMachine" From Azure CLI regards

Iwan

· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

az vm restart -g ResourceGroup -n VirtualMachine

0 Votes 0 · ·

Hello Iwanvandewetering,

I'm talking about an automatic restart of a failed VM, not a manual VM restart.

Regards

0 Votes 0 · ·
mattschlarb avatar image
1 Vote"
mattschlarb answered ·

Ok I got it now. It was a little bit of a hassle because the metric "Hearbeat" is not available under standard VM metrics (waagent), but only in connection with Log Analytics (omsagent). Connect VM to Log Analytics Workspace where your create a monitoring rule with a condition that monitors the VM's Hearbeat signal. As action, create a PowerShell automation runbook which reboots the VM. Basically it's like @theodorbrander mentioned, only the Log Analytics part was missing.

· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The only thing that baffles me was that sometimes it takes up to 15 minutes until the VM gets rebooted. Maybe it's the whole runbook automation framework and its authentication methods or whatsoever...

0 Votes 0 · ·