Azure Application Insights - Process CPU in Worker Role - azure

I have created a Cloud Service project with following roles:
One Web role
One Worker role
For both the roles, I have added Azure Application Insights SDK/ Nuget pkg. I have also added the Status Monitor to both of them, StartUp task. Two roles point to different AI resources. For Worker role I also added the below three environment variables in csdef file.
<Environment>
<Variable name="COR_ENABLE_PROFILING" value="1" />
<Variable name="COR_PROFILER" value="{324F817A-7420-4E6D-B3C1-143FBED6D855}" />
<Variable name="MicrosoftInstrumentationEngine_Host" value="{CA487940-57D2-10BF-11B2-A3AD5A13CBC0}" />
</Environment>
The problems is unlike Web role, Worker role doesn't populate the CPU usage/Available memory in Application Insights, as can be shown below.
Application Insights resource of Worker Role:
What can be the issue and can I use any GUID in the environment variables shown above?
Also, it seems that for worker roles we need to set the ApplicationInsights.config file to be copied always to the output directory. However, when I do that, worker role throws the task exception and keeps on restarting, which finally fails the deployment.

1) In order to collect the performance counters account that you worker role process (WaWorkerHost.exe) running under should be part of Performance Monitor users group.
Take a look at the thread below: it explains how to modify start up task (InstallAgent.ps1) to give the right permissions. It's done for the web role, so you'll need to replace $user = "Network Service" with the right account in your case.
add Azure Application insight Status Monitor from command line
2) No, you cannot use any GUID for env variable. It's predefined COM object GUID of AppInsights profiler.

Related

Issue with APP Service Plan in a Resource Group

I'm not trying to delete any App Service Plan or App Service, But I'm seeing “This resource has a 'delete' lock that prevents us from deleting the
resource. Please remove the lock and try again.” message on our App Service Plans under one Resource Group, Other Resource Group App Service Plans are fine.
All App Services are working fine under faulty Resource Group.
While Creating Dashboard using Faulty Resource Group, App Service Plans and App Services are not visible.
Please guide fixing this issue.
Resource locks don't just prevent deletion. There are two types of locks: CanNotDelete and ReadOnly. If a ReadOnly lock is applied, you won't be able to make administrative changes to the resource. I suggest clearing the locks and seeing if this message goes away.

How to get subscription id programmatically in a Azure Role?

I have this Worker Role which makes use of REST Management API (through https://github.com/Azure/azure-sdk-for-net), whose the most basic pre-requisite is the Subscription ID.
Is there a way to get the Subscription ID from a running (worker) role? E.g. say, through RoleEnvironment?
Sorry Gatis, there is no way to get this via any method provided by Azure*. You would need to pass this information into your role using something like the CSCFG configuration settings.
For a little more context - the subscription ID is only known at the RDFE layer. Once you are in the Fabric layer (ie. your running Worker Role) then there is no concept of a subscription ID. You can see http://blogs.msdn.com/b/kwill/archive/2011/05/05/windows-azure-role-architecture.aspx, process A and steps 1&2, for a little more info.
*If you are using AAD authentication for your Service Management API calls then you could get a list of all subscriptions for that AAD user using 'List Azure Subscriptions' - http://msdn.microsoft.com/en-us/library/azure/dn775050.aspx. With those subscriptions you could enumerate all cloud services and match the deployment ID to the deployment ID for your worker role.
Edit: Typo in first paragraph. Changed 'something like the Subscription ID' to 'something like the CSCFG configuration settings'.

Azure role hosting autoscaling block can not boost

I has written a simple Azure deployment to test Azure Auto-scaling block, which contained two role: one work role , one monitor role hosting auto-scaling block.
I wrote those code followed http://www.windowsazure.com/en-us/develop/net/how-to-guides/autoscaling/ step by step,
In the onStart() method of monitor role, there is:
{
.....
scaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();
scaler.Start();
return base.OnStart();
}
then i deploy them, but only the work role instance can boost successfully, the monitor role instance show it was always busy,
The azure portal show that error message:
Starting role... Unhandled Exception: System.Reflection.TargetInvocationException [2013-04-27T09:54:57Z])
can someone teach me how to get detailed error stack?
or somebody experienced with Azure can figure out what wrong i happened?
Any advice will be appreciated!

Enable Diagnostics in Windows Azure without .NET

I'm using Windows Azure to host my python project and I'm trying to enable the diagnostics without good results.
As I'm using python and not .NET, the only way I can actually configure it is through config files.
Below my config files:
ServiceDefinition.csdef
...
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
...
ServiceConfiguration.Cloud.cscfg
....
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=<my-account-name>;AccountKey=<my-account-key"/>
....
diagnostics.wadcfg:
<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration"
configurationChangePollInterval="PT10M"
overallQuotaInMB="1200">
<DiagnosticInfrastructureLogs bufferQuotaInMB="100"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M" />
<Logs bufferQuotaInMB="200"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M" />
<Directories bufferQuotaInMB="600"
scheduledTransferPeriod="PT5M">
<CrashDumps container="wad-crash-dumps" directoryQuotaInMB="200" />
<FailedRequestLogs container="wad-frq" directoryQuotaInMB="200" />
<IISLogs container="wad-iis" directoryQuotaInMB="200" />
</Directories>
<WindowsEventLog bufferQuotaInMB="200"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M">
<DataSource name="System!*" />
</WindowsEventLog>
</DiagnosticMonitorConfiguration>
In Diagnostics Manager, I can't actually see any data.
Thanks.
May i ask where your diagnostics.wadcfg located? For a regular worker role the diagnostics.wadcfg must be in the root folder and because you don't have worker role module in your project the location of the architecture of your role folder is very important. Be sure to have exact same folder structure in your Python application as a regular worker role and then drop the diagnostics.wadcfg in the role root folder. (add that info back to your question to verify)
Do you see a diagnostics configuration XML is created in your Windows Azure Blob storage which is configured in the *.Diagnostics.ConnectionString. This is a check which suggests that the diagnostics component in the Azure role was able to read the provided configuration and could create the configuration XML at destination blob stroage (same Azure Storage will be use to write log Azure Table storage). Please verify.
Finally your diagnostics.wadcfg need some more work. As this is a non .net worker role you have configured IIS logging (do you really have IIS running in worker role? ) and also have System event log scheduled to transfer "warning only" so if there are no warnings. Finally the log transfer time is set to 5 minutes which is long during test.
What i can suggest as below to test if diagnostics is working or not:
Remove the IIS log if you dont have IIS running the Azure VM
Replace event log DataSource from System!* to Application!* and set filter to Info level
Change the log transfer time to less then a minutes
Run the exact same code in Development Fabric with Diagnostics connection string connected to Actual Azure Storage.
Add custom event log in your machine and see if they are transferred within the time limit to Azure Table storage and specific tables are created
Above should help you to troubleshoot the problem.

How to access resource file in worker role class

I am using a worker role in windows azure for sending emails. I have saved the email format in the resource file for the worker role. But i am unable to find a way to use the resources in the resource file. In webapplications one can use GetLocalResourceObject but there is nothing like this in worker role.
I have just one default culture resource file.
I have found the solution. one can use the resources of the webrole by WebRole1.Properties.Resources.MyResourceName

Resources