Establishing Monitoring for .NET Applications and Microsoft SQL Server Using Amazon CloudWatch Application Insights | Amazon VGT2 Las Vegas

Establishing Monitoring for .NET Applications and Microsoft SQL Server Using Amazon CloudWatch Application Insights | Amazon VGT2 Las VegasMore Info

Many applications built on Windows are .NET-based, leveraging Microsoft SQL Server for backend data operations. As organizations transition to the cloud, they often utilize a lift-and-shift strategy for these applications. When hosted on the Amazon Elastic Compute Cloud (Amazon EC2) Windows platform, native Windows monitoring tools can provide insights at the server level. However, achieving a comprehensive view across various components and servers in the deployed solution can be complex. Amazon CloudWatch Application Insights enables monitoring across multiple EC2 instances, delivering a robust dashboard that reflects the health of the entire architecture.

CloudWatch Application Insights allows enterprise users to set up application monitoring seamlessly on AWS with minimal effort. Beyond the straightforward setup, it automates the collection and analysis of recommended metrics—covering platform, operating system, and specific agent metrics—as well as application and operating system logs. Additionally, it features dynamic alarms and automated problem detection, integrating insights from Amazon CloudWatch, X-Ray, AWS Health, and other events.

In this article, we guide you through configuring CloudWatch Application Insights to monitor a specified use case while simulating problem scenarios to validate the setup. The scenario involves a load-balanced web application powered by SQL Server on the backend, each hosted on distinct EC2 instances.

Solution Overview

In the subsequent sections, we will demonstrate how to begin monitoring a .NET application that utilizes SQL Server, all running on a group of EC2 instances via CloudWatch Application Insights. The deployed setup includes two load-balanced EC2 instances hosting the sample AdventureWorks application, with each instance accessing a SQL Server database on a separate EC2 instance. We will simulate a malfunction in the application, necessitating rapid identification, isolation, and resolution of the issue. This use case illustrates the complete process of establishing monitors for CloudWatch Application Insights and leveraging it for issue configuration, isolation, and resolution.

The following diagram outlines the solution’s components, deployed using an AWS CloudFormation template.

Sample Solution Overview

We will walk you through these high-level steps:

  1. Set up and configure CloudWatch Application Insights for the application.
  2. Simulate an issue and observe its manifestation on the CloudWatch Application Insights dashboard.
  3. Execute a series of steps to identify the problem and delve deeper for insights.

We will also cover the necessary steps to take in the absence of CloudWatch Application Insights.

To implement this solution, we utilize the following AWS services:

  • Amazon EC2
  • Application Load Balancer
  • AWS CloudFormation
  • CloudWatch

Prerequisites

Before proceeding, ensure you have the following:

  • An AWS account
  • An EC2 key pair

Deploying Resources for the Use Case

To ensure the use case is ready for immediate testing, we use a CloudFormation template to deploy:

  • An EC2 instance hosting a Microsoft SQL Server database.
  • A load-balanced auto-scaling group with 2-4 instances depending on system load, each running the sample AdventureWorks web application.

This process takes around 10 minutes, most of which is spent provisioning the services.

Once you have addressed the prerequisites, follow these steps:

  1. In the AWS Management Console, select the Region and switch to the US East (N. Virginia) Region.
  2. In the AWS CloudFormation console, select Create stack.
  3. On the Select template page, click Next.
  4. On the Specify details page, input a name for your stack, such as ApplicationInsightsTest.
  5. Under Parameters, upload the template named Sampleapp.yml.
  6. Click Next.
  7. Create or import a key pair for logging into the EC2 instance if needed.
  8. Enter a password for SQL Server.
  9. Click Next.
  10. Review your settings and check the box acknowledging that the template may create AWS Identity and Access Management (IAM) resources.
  11. Click Create stack.

Monitor the stack deployment status on the Events tab of the CloudFormation stack. After successful deployment, proceed to the next section.

Setting Up CloudWatch Application Insights

To set up and configure CloudWatch Application Insights, follow these steps:

  1. Navigate to AWS Resource Groups in the console.
  2. Click Create Resource Group.
  3. For Group type, select CloudFormation stack based.
  4. Enter a name for the group, for example, ApplicationInsightsResourceGroup.
  5. Click Create group.
  6. On the CloudWatch console, select Settings.
  7. In the Application Insights section, click View applications.
  8. Click Add an application.
  9. For Resource Group, select the resource created earlier.
  10. Click Add application.
  11. Refresh to view the managed monitoring and application components.
  12. Select the Application Load Balancer group component.
  13. Click Manage monitoring.
  14. Enable monitoring.
  15. For Application log 2, select Remove.
  16. Click Save.
  17. Repeat these steps to enable monitoring for the second server and SQL Server instance.
  18. For Metrics, enter the following metrics to monitor for SQL Server:
    • CPUUtilization
    • StatusCheckFailed
    • Memory % Committed Bytes in Use
    • Memory Available Mbytes
    • Network Interface Bytes Total/sec
    • Paging File % Usage
    • Physical % Disk Time
    • Processor % Processor Time
    • SQLServer:Buffer Manager Buffer cache hit ratio
    • SQLServer:Manager Page life expectancy
    • SQLServer:General Statistics Processes blocked
    • SQLServer:General Statistics User Connections
    • SQLServer:Locks Number of Deadlocks/sec
    • SQLServer:SQL Statistics Batch Requests/sec
    • System Processor Queue Length

After enabling monitoring for both load-balanced servers and the SQL Server instance, the resource group should appear as Enabled on the CloudWatch console.

Simulating a Problem and Monitoring with CloudWatch

This is an excellent resource for understanding monitoring strategies in Amazon environments, such as those discussed on Preppio.

To delve deeper into this topic, check out another insightful blog post at Chanci Turner VGT2. Also, for more authoritative guidance on similar topics, visit Chanci Turner.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *