Skip to content

Commit 0bf16e7

Browse files
committed
wf cloud watch monitoring
1 parent d4a97d5 commit 0bf16e7

File tree

2 files changed

+1300
-0
lines changed

2 files changed

+1300
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# AWS CloudWatch Dashboard for FSx for ONTAP
2+
3+
## Introduction
4+
5+
This solution provides a CloudFormation template to deploy an AWS CloudWatch dashboard for monitoring FSx for ONTAP systems. The dashboard offers comprehensive insights into your FSx for ONTAP resources, helping you monitor performance, track metrics, and manage alarms efficiently.
6+
The template creates the following resources:
7+
8+
1. Dashboard - The Amazon CloudWatch dashboard divided into four main sections:
9+
a. Overview metrics of all FSx systems in the region
10+
b. Metrics by individual FSx system
11+
c. Metrics by volume ID
12+
d. Alarms
13+
2. Lambda - The service does the following:
14+
a. Build custom widgets for the dashboard
15+
b. Collect metrics directly from ONTAP (like snapmirror unhealthy relations)
16+
c. Create alarms for all files systems in the region
17+
3. Schedulers - Two Amazon EventBridge schedulers that triggers the Lambda metrics collection every minute and alarms creating/updating every hour.
18+
4. Lambda Role - The IAM role that allows the Lambda service to run.
19+
5. Scheduler Role - The IAM role that allows the scheduler to trigger the Lambda service.
20+
6. SecretManager endpoint - The Lambda function runs inside a VPC, which by default lacks outgoing internet connectivity. To enable the function to securely access the fsxadmin passwords stored in AWS Secrets Manager, a VPC endpoint for the Secrets Manager service is required.
21+
This endpoint allows the Lambda function to retrieve sensitive information from Secrets Manager without needing direct internet access, maintaining security while ensuring the function can access the necessary credentials.
22+
7. CloudWatch endpoint - The Lambda function runs inside a VPC, which by default lacks outgoing internet connectivity. To enable the function to send logs and metrics to CloudWatch, a VPC endpoint for the CloudWatch service is required.
23+
This endpoint allows the Lambda function to communicate with CloudWatch without needing direct internet access, maintaining security while ensuring proper monitoring and logging functionality.
24+
8. FsxService endpoint - The Lambda function runs inside a VPC, which by default lacks outgoing internet connectivity. To enable the function to send calls to FsxService to reterive file systems inforamtion.
25+
26+
## Prerequisites
27+
28+
1. You should have an AWS Account with the following permissions to create and manage resources:\
29+
"cloudformation:DescribeStacks",\
30+
"cloudformation:ListStacks",\
31+
"cloudformation:DescribeStackEvents",\
32+
"cloudformation:ListStackResources",\
33+
"cloudformation:CreateChangeSet",\
34+
"ec2:DescribeSubnets",\
35+
"ec2:DescribeSecurityGroups",\
36+
"ec2:DescribeVpcs",\
37+
"iam:ListRoles",\
38+
"iam:GetRolePolicy",\
39+
"iam:GetRole",\
40+
"iam:DeleteRolePolicy",\
41+
"iam:CreateRole",\
42+
"iam:DetachRolePolicy",\
43+
"iam:PassRole",\
44+
"iam:PutRolePolicy",\
45+
"iam:DeleteRole",\
46+
"iam:AttachRolePolicy",\
47+
"lambda:AddPermission",\
48+
"lambda:RemovePermission",\
49+
"lambda:InvokeFunction",\
50+
"lambda:GetFunction",\
51+
"lambda:CreateFunction",\
52+
"lambda:DeleteFunction",\
53+
"lambda:TagResource",\
54+
"codestar-connections:GetSyncConfiguration",\
55+
"ecr:BatchGetImage",\
56+
"ecr:GetDownloadUrlForLayer",\
57+
"scheduler:GetSchedule",\
58+
"scheduler:CreateSchedule",\
59+
"scheduler:DeleteSchedule",\
60+
"logs:PutRetentionPolicy",\
61+
"secretsmanager:GetSecretValue", (on specific secert)
62+
63+
2. Optional: create a secret in AWS Secrets Manager with key-value pairs of file system IDs and their corresponding fsxadmin passwords. This secret is necessary for making direct ONTAP API calls to monitor resources, such as SnapMirror relations.
64+
Example secret structure:
65+
66+
```json
67+
{
68+
"fs-111222333": "Password1",
69+
"fs-444555666": "Password2"
70+
}
71+
```
72+
73+
When deploying the CloudFormation template, you will need to provide the ARN of this secret as a parameter. This allows the Lambda to securely access the passwords for monitoring purposes.
74+
Note: If you choose not to provide this secret, some monitoring capabilities (such as SnapMirror relations metrics) may be limited.
75+
76+
## Usage
77+
78+
To use this solution, you will need to run the CloudFormation template in your AWS account.
79+
The CloudFormation template requires the following parameters:
80+
81+
1. Subnet IDs - The IDs of the subnets in which the Lambda function will run. These subnets must have connectivity to the file systems.
82+
2. Security Group IDs - The IDs of the Security Groups that will be associated with the Lambda function when it runs. These Security Groups must allow
83+
connectivity to the file systems.
84+
3. VPC ID - The ID of the VPC in which the Lambda function will run. This VPC must have connectivity to all target file systems. It can be either the same VPC where the
85+
file systems are located, or a different VPC with established connectivity (e.g., VPC peering, Transit Gateway) to the file systems' VPCs.
86+
4. Create Secret Manager Endpoint - A boolean flag indicating whether you plan to create a SecretManager VPC endpoint inside the VPC. Set this to true if
87+
you want to create the endpoint, or false if you don't. The decision to create this endpoint depends on whether you already have this type of endpoint. If you already have one, set this to false; otherwise, set it to true.
88+
5. Create CloudWatch Endpoint - A boolean flag indicating whether you plan to create a CloudWatch VPC endpoint inside the VPC. Set this to true if you want
89+
to create the endpoint, or false if you don't. The decision to create this endpoint depends on whether you already have this type of endpoint. If you already have one, set this to false; otherwise, set it to true.
90+
6. Create Fsx Service Endpoint - A boolean flag indicating whether you plan to create a FsxService VPC endpoint inside the VPC. Set this to true if you want
91+
to create the endpoint, or false if you don't. The decision to create this endpoint depends on whether you already have this type of endpoint. If you already have one, set this to false; otherwise, set it to true.
92+
7. Secret Manager FSx Admin Passwords ARN - Optional - The ARN of the AWS Secrets Manager secret containing the fsxadmin passwords. This ARN is required for certain
93+
functionalities, such as snapmirror metrics collection.
94+
If not provided, some features may not operate correctly. This secret should contain key-value pairs.
95+
The key is the File System ID, and the value is the password. For example:
96+
{"fs-111222333":"Password1","fs-444555666":"Password2"}
97+
98+
## Important Disclaimer: CloudWatch Alarms Deletion
99+
100+
Please note that when you delete the CloudFormation stack associated with this project, the CloudWatch Alarms created by the stack will not be automatically deleted.
101+
102+
CloudFormation does not manage the lifecycle of CloudWatch Alarms created by the Lambda. This means that even after stack deletion, these alarms will persist in your AWS account.
103+
104+
To fully clean up resources after using this solution:
105+
106+
1. Delete the CloudFormation stack as usual.
107+
2. Manually review and delete any associated CloudWatch Alarms through the AWS Console or using AWS CLI/SDK.
108+
You can find the alarms by searching for the name prefix "FSx-ONTAP" in the CloudWatch Alarms section.
109+
110+
This behavior ensures that important monitoring setups are not unintentionally removed, but it requires additional steps for complete resource cleanup.
111+
112+
## Author Information
113+
114+
This repository is maintained by the contributors listed on GitHub.
115+
116+
## License
117+
118+
Licensed under the Apache License, Version 2.0 (the "License").
119+
120+
You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.
121+
122+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, without WARRANTIES or conditions of any kind, either express or implied.
123+
124+
See the License for the specific language governing permissions and limitations under the License.

0 commit comments

Comments
 (0)