Can I capture Performance Counters for an Azure Web/Worker Role remotely…?

痴心易碎 提交于 2020-02-05 07:23:28

问题


I am aware of the generation of the Performance Counters and Diagnosis in webrole and worker-role in Azure.

  • My question is can I get the Performance Counter on a remote place or remote app, given the subscription ID and other certificates (3rd Party app to give performance Counter).

Question in other words, Can I get the Performance Counter Data, the way I use Service Management API for any hosted service...?

What are the pre-configurations required to be done in Server...? to get CPU data...???


回答1:


Following is the description of the attributes for Performance counters table:

EventTickCount: Stores the tick count (in UTC) when the log entry was recorded.

DeploymentId: Id of your deployment.

Role: Role name

RoleInstance: Role instance name

CounterName: Name of the counter

CounterValue: Value of the performance counter

One of the key thing here is to understand how to effectively query this table (and other diagnostics table). One of the things we would want from the diagnostics table is to fetch the data for a certain period of time. Our natural instinct would be to query this table on Timestamp attribute. However that's a BAD DESIGN choice because you know in an Azure table the data is indexed on PartitionKey and RowKey. Querying on any other attribute will result in full table scan which will create a problem when your table contains a lot of data.

The good thing about these logs table is that PartitionKey value in a way represents the date/time when the data point was collected. Basically PartitionKey is created by using higher order bits of DateTime.Ticks (in UTC). So if you were to fetch the data for a certain date/time range, first you would need to calculate the Ticks for your range (in UTC) and then prepend a "0" in front of it and use those values in your query.

If you're querying using REST API, you would use syntax like:

PartitionKey ge '0<from date/time ticks in UTC>' and PartitionKey le '0<to date/time in UTC>'.

You could use this syntax if you're querying table storage in our tool Cloud Storage Studio, Visual Studio or Azure Storage Explorer.

Unfortunately I don't have much experience with the Storage Client library but let me work something out. May be I will write a blog post about it. Once I do that, I will post the link to my blog post here.

Gaurav




回答2:


Since the performance counters data gets persisted in Windows Azure Table Storage (WADPerformanceCountersTable), you can query that table through a remote app (either by using Microsoft's Storage Client library or writing your own custom wrapper around Azure Table Service REST API to retrieve the data. All you will need is the storage account name and key.



来源:https://stackoverflow.com/questions/5620720/can-i-capture-performance-counters-for-an-azure-web-worker-role-remotely

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