Thursday, November 24, 2016

Azure App services - Coniguring endpoint monitoring and alerts

Endpoint monitoring is a feature that enables you to monitor your website from external geo-distributed locations. This feature is uniquely different from traditional performance counter monitoring where you are monitoring metrics on the server that the website is running on. Azure Websites support up to two endpoints for endpoint monitoring. Each endpoint can
be monitored (or tested) from up to three locations. For each endpoint you want to configure a web test for, the following information is required:


- Test Name A name you will use to identify the test in the management portal.
- URL The URL you want Azure to perform tests against. This can be your root website URL, such as contoso.com, or perhaps a custom health check page.
- Test Locations The external locations you want Azure to perform the tests from. This can range from one to three locations.
- Success Criteria The HTTP status code Azure should expect to indicate a successful test. Generally, this would be HTTP 200 (OK). Optionally, you can configure a content match, which is specific text in the response that Azure can look for to determine if the test was successful.
- Alerts You can choose to enable an alert to notify by email service administrators and co-administrators on the subscription, or other administrators by specifying the email address.


IMP :: EXAM TIP
Alerts can be configured with a sensitivity setting of low (1), medium (2), or high (3). A setting of low triggers an alert when all test locations detect a failure within 15 minutes. A setting of medium triggers an alert when at least half of the test locations detect a failure in 10 minutes. A setting of high triggers an alert any time a failure is detected.



With endpoint monitoring and alerts configured, you can let Azure perform the web tests as you have configured them, and wait for an email alert if a problem is detected. However, you can also get very useful information from the management portal relating to endpoint monitoring to see how the tests are performing, if any tests have failed and why, and metrics
captured by the endpoint monitoring service.

The Web Test blade shows a graph of server response times, the number of successful tests, and the number of failed tests. The Test Locations section of the blade shows the locations the web test is being run from and the success rate in 20 minute, 1 hour, 24 hour, and 72 hour increments. The Failed Tests section will show tests that have failed per location, and you can
click each one to see the test details and learn more about why the test failed. The Web Test blade, as shown in Figure, provides a nice visual of how the web tests are performing, the number of successful tests, and the number of failed tests.

Azure App services - Monitoring website resources

The Website blade is divided into sections such as Summary, Monitoring, Usage, Operations, Deployment, Networking, Configurations and Access. Each section is pre-configured with live parts that provide various metrics for the website.

 
You can quickly see the resources in the resource group of the website in the Summary section of the Website blade. Figure is an example showing a resource group named Contoso Website that contains an Azure website, a virtual machine running SQL Server, and other resources. By clicking the Contoso Website resource group, you can then drill down further into all the resources in the group


A resource group consisting of a website, virtual machine, and other resources
Azure Websites provide a number of useful performance counter metrics that you can monitor visually in a graph or in a line item detailed list using the management portal. Metrics that are available for websites are listed here:
- CPUTime A measure of the website's CPU usage.
- Requests A count of client requests to the website.
- Data Out A measure of data sent by the website to clients.
- Data In A measure of data received by the website from clients.
- HTTP Client Errors Number of HTTP 4xx Client Error messages sent.
- HTTP Server Errors Number of HTTP 5xx Server Error messages sent.
- HTTP Successes Number of HTTP 2xx Success messages sent.
- HTTP Redirects Number of HTTP 3xx Redirection messages sent.
- HTTP 401 Errors Number of HTTP 401 Unauthorized messages sent.
- HTTP 403 Errors Number of HTTP 403 Forbidden messages sent.
- HTTP 404 Errors Number of HTTP 404 Not Found messages sent.
- HTTP 406 Errors Number of HTTP 406 Not Acceptable messages sent.
 

Thursday, October 27, 2016

Viewing streaming logs using Azure PowerShell & using Site Control Manager

Using the Get-AzureWebsiteLog cmdlet, you can stream logs directly in the Azure PowerShell console window. The code shown here connects to the log-streaming service to start streaming the web server logs.

Get-AzureWebsiteLog -Name "contoso-web-west" -Tail -Path http


The Get-AzureWebsiteLog also supports a Message parameter that you can use to ilter
the output when streaming application logs. For example, the code shown here ilters the
log-streaming output to just application logs that are categorized as errors.


Get-AzureWebsiteLog -Name "contoso-web-west" -Tail -Message Error


 

Viewing streaming logs using Site Control Manager 

The log-streaming service is available in the Site Control Manager as an option in the Tools menu, as shown in Figure
 
The Tools menu in Site Control Manager showing the Log Stream option

Viewing streaming logs using the management portal

The streaming log service is accessible from the Website blade of your website. Scroll down to the Operations section where you will see the Streaming Logs part, as shown in Figure


The Streaming Logs part on the Website blade of the management portal

In the Streaming Logs blade, you can toggle between application and web server logs,pause and start the log-streaming service, and clear the logs in the console. Figure shows example output for the web server logs in the Streaming Logs blade

The Streaming Logs blade showing web server logs


Using Azure PowerShell to retrieve log files

You can download all the log iles using the Azure PowerShell cmdlet Save-AzureWebsiteLog, as shown in the code below. This code will download the log iles and store them in E:\Weblogs.zip on the client computer.
$wsName = "contoso-web"
Save-AzureWebsiteLog -Name $wsName -Output e:\weblogs.zip

NOTE :: SAVING LOG FILES TO LOCAL COMPUTER USING POWERSHELL
Using the Save-AzureWebsiteLog cmdlet to download log files will download all logs except the Failed Request logs. If you use this method for retrieving log files, you will need to use one of the other options to retrieve failed request logs separately.


Using Site Control Manager (Kudu) to retrieve log files

Site Control Manager, often referred to as ”Kudu”, is a website extension that you can use to retrieve log files, browse the file system, edit files, delete files, view environment variables,and even capture diagnostic dump files.

To access the Site Control Manager, open your browser and navigate to
https://.scm.azurewebsites.net

Note : Every Azure website gets the Site Control Manager site extension installed by default.There is nothing you have to do to enable it.

The URL is the same as the URL for your website, with the added scm. immediately after the website name. Figure is an example of what the Site Control Manager screen looks like for a website.


The home page of the Site Control Manager site extension

Using Site Control Manager, select the Debug Console and then select the CMD option.This opens a debug console that you can type directly into or use the navigation above. As you click the navigation links, the debug console will update to your current directory. Figure shows the debug console screen and the contents of the Log Files folder.
The debug console in Site Control Manager and viewing the Log Files folder

Using Site Control Manager, you can download an entire folder or individual iles by clicking
the download link to the left of the directory or ile name.

Featured Posts

Adding Accesspolicy to KeyVault for Service Principal Using Portal and Powershell

  Scripts path : https://drive.google.com/drive/folders/1sbBpnVFgXhUIXLdf2E9heyWDeU2f9427?usp=sharing  Adding Accesspolicy to KeyVault for S...