cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

Microsoft Azure App Service.apm-template

Prerequisites:

To connect with your Azure account, the following parameters are required:

     subcriptionID,ApplicationID,TenantID, Secret Key, Application Name

     Note: Azure App to monitor, with its name and ID, should have role set as 'contributor or Reader' in the Azure access control.

    2. Application name for which metrics will be calculated.

    3. Time interval for which data has to be fetched (in hours).

    4. PowerShell version supported 5.1 or above.

Script Argument:

  • Login credential to access Azure Portal. Azure details have to be passed in script arguments as per prerequisite #2.

             Example:

             <SubscriptionID>,<TenantID>,<ApplicationID>,secretKey=<Enter SecretKey>,<ApplicationName>,TimeRange=<Time in hrs>

  • The ApplicationID with which you are making a connection to the Azure portal (as mentioned in Credential/Prerequisites) must be registered in Azure Active Directory as a contributor role for the monitored application.

        Reference link: https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Knowledgebase_Article...

Portions of this document were originally created by and are excerpted from the following sources:

https://docs.microsoft.com/en-us/azure/app-service/web-sites-monitor  

https://docs.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azurermps-6.7.0

https://docs.microsoft.com/en-us/powershell/module/azurerm.insights/?view=azurermps-6.7.0&viewFallba...

MONITORED COMPONENTS

  • Average number of bytes sent

      This monitor provides the average number of bytes sent for the given app.

      Unit: MB (Mega Bytes)

  • Total number of 2xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 200 but < 300 for the given app.

      Unit: Count

  • Total number of 3xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 300 but < 400 for the given app.

      Unit: Count

  • Total number of 401 requests

      This monitor provides the count of requests resulting in HTTP 401 status code for the given app.

      Unit: Count

  • Total number of 403 requests

      This monitor provides the count of requests resulting in HTTP 403 status code for the given app.

      Unit: Count

  • Total number of 404 requests

      This monitor provides the count of requests resulting in HTTP 404 status code for the given app.

      Unit: Count

  • Total number of 406 requests

      This monitor provides the count of requests resulting in HTTP 406 status code for the given app.

      Unit: Count

  • Total number of 4xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 400 but < 500 for the given app.

      Unit: Count

  • Total number of 5xx requests

      This monitor provides the count of requests resulting in an HTTP status code >= 500 but < 600 for the given app.

      Unit: Count

  • Total number of requests served by the app

      This monitor provides the total number of requests regardless of their resulting HTTP status code for the given app.

      Unit: Count

  • Average number of bytes received

      This monitor provides the average number of bytes received for the given app.

      Unit: MB (Mega Bytes)

  • Average memory used

      This monitor provides the average amount of memory in MBs used by the given app.

      Unit: MB (Mega Bytes)

  • Average response time

      This monitor provides the average time taken for the app to serve requests in milliseconds (ms).

      Unit: MS (Milliseconds)

TROUBLESHOOTING STEPS

Detailed troubleshooting steps (common for template):

Check that the PowerShell version is 5.1 or more and the Azure module is installed on the system where the template will run.

Template uses PowerShell components; script should run with administrator privilege.

Be sure to detail troubleshooting steps (specific for components).

Components connect with Azure using service principal authentication for which application has to be created at the Azure portal. See below link:

     https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-create-service-principals

Provide Azure IAM permission to the application, which was created in the last step. See below link:

     https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Knowledgebase_Article...

Script fetch data based on time range given in last script arguments. By default, script fetch data for the past hour. While giving the time range, make sure the data is available for the metric at that time, otherwise the component will be unable to fetch the data.

Labels (1)
Attachments
Comments

Is there any information available with how to get this installed and running in SolarWinds?

Did you see the info and instructions on setup above in the description of the template?

Prerequisites:

To connect with your Azure account, the following parameters are required:

     subcriptionID,ApplicationID,TenantID, Secret Key, Application Name

     Note: Azure App to monitor, with its name and ID, should have role set as 'contributor or Reader' in the Azure access control.

    2. Application name for which metrics will be calculated.

    3. Time interval for which data has to be fetched (in hours).

    4. PowerShell version supported 5.1 or above.

Script Argument:

  • Login credential to access Azure Portal. Azure details have to be passed in script arguments as per prerequisite #2.

             Example:             <SubscriptionID>,<TenantID>,<ApplicationID>,secretKey=<Enter SecretKey>,<ApplicationName>,TimeRange=<Time in hrs>

  • The ApplicationID with which you are making a connection to the Azure portal (as mentioned in Credential/Prerequisites) must be registered in Azure Active Directory as a contributor role for the monitored application.

        Reference link: https://support.solarwinds.com/Success_Center/Server_Application_Monitor_(SAM)/Knowledgebase_Article...

Yes, but what I am not seeing is how to make the script run in the first place.  Where do the parameters go?  How do I apply the template?

You will need to go to the SAM Summary and then click "Manage Applications" and then click the "Application Monitor Templates" tab.

Once there, you can "Import" the template you downloaded from this page (if you haven't already)

Then you just need to select the template from the list and "Assign to Node"

Once the template is assigned to the node you can edit the application template and use a "Multi Edit" to enter the script parameters.

I included a few screen shots below to help clarify where you need to go for each step.

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

pastedImage_5.png

Awesome reply - thank you so much!

I added my Azure credentials to the script parameters after I configured they were good with the Cloud management configuration.  Below is the error I get when I try to test:

Output: ==============================================

[ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Errors: ==============================================

Exception calling "WaitOne" with "0" argument(s): "The wait completed due to an abandoned mutex."

At line:140 char:4

+ if($mtx.WaitOne() ){

+ ~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException

+ FullyQualifiedErrorId : AbandonedMutexException

Get-AzureRmResource : Run Connect-AzureRmAccount to login.

At line:115 char:19

+ $resID = (Get-AzureRmResource -Name $Appname).ResourceId

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : CloseError: (:) [Get-AzureRmResource], PSInvalidOperationException

+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet

I am using one of my management servers as the "node" the monitor is applied to and verified I have the Azure and AzureRM modules installed.

I would create a new "External" node pointed to portal.azure.com and apply the template to that rather than your management server.

pastedImage_1.png

Thank you again for the guidance jvb!

I was able to create a new external node. but when I test against it, I get the error below:

I have added the following arguments through the multi-edit description above, in the format listed above (<SubscriptionID>,<TenantID>,<ApplicationID>,secretKey=<Enter SecretKey>,<ApplicationName>,TimeRange=<Time in hrs>)

cf2f7fac-ef5f-XXxX-XxXx-XXXXXXaec51f,c8551ca9-xxxx-xxxx-8af6-334e28Xxx652,secretKey=XxXxXxXxXx/+VyxU+eeSoqaQN5cA1OhLoXI6MZSss+M=,app-p-ApplicationCSearchMgr,TimeRange=1

COMPONENT TEST RESULT DETAILS

Output: ==============================================
[ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Errors: ==============================================
Exception calling "WaitOne" with "0" argument(s): "The wait completed due to an abandoned mutex."
At line:138 char:4
+ if($mtx.WaitOne() ){
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : AbandonedMutexException

Cannot convert value "" to type "System.Int32". Error: "Input string was not in a correct format."
At line:107 char:5
+ $st = (get-date).addhours(-$timerange)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToInteger

Get-AzureRmResource : Run Connect-AzureRmAccount to login.
At line:113 char:19
+ $resID = (Get-AzureRmResource -Name $Appname).ResourceId
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmResource], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet

I just uploaded a new version of the template. Go ahead and replace the one you have with a fresh download from the original article above and see if that helps.

Hi jvb​,

Thank you so much for the nice write up.

I have downloaded the app service template (on 1/25/19) from the above and updated with all Application/Subscription/Tenant/IDs, Key, ApplicationName, TimeRange as 1. But, I have got the below error for all the components. I have created an external node as portal.azure.com and assigned to template as well. While testing, got the below error. Please help me asap. I need to get it worked, so that we would get more benefitted. I have raised case as well with Solarwinds and got the response to refer your article only

BTW, I have tested the credentials through Cloud Infrastructure Monitoring Settings by adding an account successfully.

Output: ==============================================

Account SubscriptionName TenantId Environment

------- ---------------- -------- -----------

xxxxxxx-xxxx-xxxx-xxxx-6d12bb6a03da PROD xxxxxxxx-xxxx-xxxx-xxxx-c70dcacf2984 AzureCloud

1

[ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Trying to reconnect..

[ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Trying to reconnect..

[ERROR] Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Error while connecting

=============================================================================

I have selected None for Credentials for Monitoring from the component. Please advise asap.

I have not got any reply. Would anyone else, please respond. I need to update the client asap. Thank you.

Can you try adding one more argument: "TimeRange=1" to your parameters?

Example:

subcriptionID, ApplicationID , TenantID, Secret Key, Application Name,TimeRange=1

Also make sure that the "Secret Key" argument is actually input that way on the argument line:

subcriptionID, ApplicationID , TenantID, SecretKey=xxxxxxxx, Application Name,TimeRange=1

I was having problems with this template as well (even the latest one).  Had to do a couple things in order to get it to work.

  1) In the Get-AzureRMMetric command of the getAzureMetric function the -TimeGrain was hardcoded to 00:01:00

  2) In that same command the -MetricNames switch was changed to -MetricName

  3) had to include the ",value=<time in minutes>" argument  (in my case it looked like this "value=10" ) in the script arguments of the component.

It also appears that as of Dec. 2018 there is a new powershell module that replaces AzureRM.  Supposed to be a bit easier to use

Hopefully the other two Azure templates go smoother.

Version history
Revision #:
1 of 1
Last update:
‎09-24-2018 02:02 PM
Updated by: