简体   繁体   English

如何以编程方式找出Azure云服务角色实例的开始日期时间(或正常运行时间)?

[英]How do I programmatically find out the start date time (or uptime) of an Azure Cloud Service Role Instance?

The old silverlight portal used to show the start datetime of each role instance so I could see when it last cycled. 旧的Silverlight门户曾经用来显示每个角色实例的开始日期时间,所以我可以看到它何时最后一次循环。

As far as I can see this information is not surfaced in the HTML5 portal. 据我所知,此信息未在HTML5门户中显示。

Is there a way to programmatically access this information via powershell or the REST API ? 有没有办法通过powershellREST API以编程方式访问此信息?

I can't find a way to see each role instance's uptime, but it looks like this will give you the time it's been since a service was last modified (ie with Swap VIPs, Uploading a Package, etc). 我找不到一种方法来查看每个角色实例的正常运行时间,但是看起来这将为您提供自从上次修改服务以来的时间(例如,使用交换VIP,上传软件包等)。 This and a good old fashioned ping (to make sure it's still alive) should help you know how long your services have been "stable". 此操作和老式的ping操作(以确保它仍然存在)应该可以帮助您知道您的服务“稳定”了多长时间。

[DateTime]::Now - (Get-AzureService | 
    Where-Object { $_.Label -eq 'MyService' } | 
    Select-Object -ExpandProperty DateModified)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM