开发者

How do I know whether my Azure role was shut down by runtime or manually?

I've deployed an Azure service - once in a while I see in my logs that OnStop() is called, then after about 20 minutes OnStart() is called. I'd like to know why that's happening.

开发者_高级运维

How can I know whether my role is restarted manually or by Azure runtime?


Can you explain what you mean by restarted manually? Is that someone logging in via RDP and hitting reboot?

You only have a few options that can trigger a reboot:

  1. Someone logged in via RDP and literally rebooted. No way to track that one. Turn off RDP if you are worried about that being a common scenario. I am not sure OnStop would even be called here.
  2. The fabric controller shuts down the instance to a.) patch the guest OS if allowed (specifying * as guest OS version) or b.) patch the root OS occasionally. You can most likely track this from looking at the infrastructure logs. Setup diagnostics to watch and transfer those logs. I have not personally tried this, but it would be my best guess to tie it together.
  3. Someone hit 'Reboot' from portal or API. There is a List Operations history API call that you can check that will tell you which LiveID or certificate called the Reboot instance API.

So, if you see a OnStop, there is not much you can do about #1 short of turning off RDP (and as I said, I am not sure it would even trigger a OnStop). You can otherwise look to the infrastructure logs and List Operations API to see what initiated it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜