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

会有一股神秘感。 提交于 2019-12-13 21:33:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7062054/how-do-i-know-whether-my-azure-role-was-shut-down-by-runtime-or-manually

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!