Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know if my Azure role instance VM was restarted?

I have an Azure web role. Sometimes it will get recycled due to an exception or due to an OS update. This will or will not include a VM restart. I want to know whether the VM was restarted or it was just the host process WaIISHost.exe restarted.

How do I find this the easiest way?

like image 214
sharptooth Avatar asked Sep 24 '12 12:09

sharptooth


2 Answers

On any machine (VM, RDP etc) you can do a command prompt

net statistics server | more

This will return the stats of the machine and have a time stamp (Statistics since) which can be taken as the last time the machine was turned on.

like image 112
medina Avatar answered Oct 04 '22 19:10

medina


There are couple of ways you can find it, once you have RDP access enabled and log into your Azure VM. Also VM recycle and role recycle could be two separate events in a given case, and a role recycle may not need VM recycle.

If there is any exception with your role host process (i.e. WaIISHost.exe), the event log will have entry about this exception and the role will restarted (or keep restarted depend on exception). If VM was restarted due to a planned or unplanned update the role host process is closed graciously and there will not be any exception logged with regard to role host process.

Also if you check the role host process start time (use ProcessExplorer) and check the System Uptime to see the difference, there should be significant time difference to explain when the role was restarted and since when the VM is running.

Finally if you look at latest waappagent.log (check the date/time to select latest) located at C:\log folder and search for role deployementID based status which will show if there was a crash specific log when the role state was changed. You may need to shuffle lots of lots to figure it out. This is another crude way to dig into Agent specific logs to figure out if there was an issue with Role host process which caused the problem.

like image 28
AvkashChauhan Avatar answered Oct 04 '22 19:10

AvkashChauhan