Powershellコマンドを使用しようとしてもローカルファイルを取得しようとしますが、パフォーマンスカウンタファイルも見つけられません。
Get-ChildItem -Path disk:\ -recurse | Select-String -Pattern "search string" # search string in the file.
経験に基づいて、ストレージをレコードに保存することをお勧めします。次にSDKを使用して、複数のインスタンスから簡単にレコードを照会することができます。
ローカルファイルにレコードを取得したい場合は、 AzureストレージSDKを使用して、WADPerformanceCountersTableからレコードを取得し、回避策としてローカルファイルにレコードを保存することができます。
C#コードが可能な場合は、documentのスニペットである次のコードを使用してください。
/ Get the connection string. When using Microsoft Azure Cloud Services, it is recommended
// you store your connection string using the Microsoft Azure service configuration
// system (*.csdef and *.cscfg files). You can you use the CloudConfigurationManager type
// to retrieve your storage connection string. If you're not using Cloud Services, it's
// recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.
string connectionString = Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("StorageConnectionString");
//string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;
// Get a reference to the storage account using the connection string. You can also use the development
// storage account (Storage Emulator) for local debugging.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
//CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
// Create the table client.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
// Create the CloudTable object that represents the "WADPerformanceCountersTable" table.
CloudTable table = tableClient.GetTableReference("WADPerformanceCountersTable");
// Create the table query, filter on a specific CounterName, DeploymentId and RoleInstance.
TableQuery<PerformanceCountersEntity> query = new TableQuery<PerformanceCountersEntity>()
.Where(
TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("CounterName", QueryComparisons.Equal, @"\Processor(_Total)\% Processor Time"),
TableOperators.And,
TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("DeploymentId", QueryComparisons.Equal, "ec26b7a1720447e1bcdeefc41c4892a3"),
TableOperators.And,
TableQuery.GenerateFilterCondition("RoleInstance", QueryComparisons.Equal, "WebRole1_IN_0")
)
)
);
// Execute the table query.
IEnumerable<PerformanceCountersEntity> result = table.ExecuteQuery(query);
// Process the query results and build a CSV file.
StringBuilder sb = new StringBuilder("TimeStamp,EventTickCount,DeploymentId,Role,RoleInstance,CounterName,CounterValue\n");
foreach (PerformanceCountersEntity entity in result)
{
sb.Append(entity.Timestamp + "," + entity.EventTickCount + "," + entity.DeploymentId + ","
+ entity.Role + "," + entity.RoleInstance + "," + entity.CounterName + "," + entity.CounterValue+"\n");
}
StreamWriter sw = File.CreateText(@"C:\temp\PerfCounters.csv");
sw.Write(sb.ToString());
sw.Close();
アズールストレージテーブルの操作方法の詳細については、Get started with Azure Table storageを参照してください。
このデータをローカルファイルに保存する理由を教えてください。 –