I try to get local file even I try to use Powershell command, but also I can't find the Performance counters file.
Get-ChildItem -Path disk:\ -recurse | Select-String -Pattern "search string" # search string in the file.
Base on my experience, it is a good practice to storage the record in the storage. Then we could use the SDK to easily query records from multiple instances.
If we just want to get the record to the local file. We could use Azure storage SDK to get the record from the WADPerformanceCountersTable and save the records to the local file as a workaround.
If C# code is possible for you, please have a try to use the following code which is the snippet from the 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();
More info about how to operate Azure storage table please refer to the Get started with Azure Table storage.