Skip to content

Commit d2df1ac

Browse files
committed
Updated so the watching CloudWatch alert could handle the SNS topic being in another region.
1 parent bf6fc34 commit d2df1ac

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

Monitoring/monitor-ontap-services/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ To install the program using the CloudFormation template, you will need to do th
102102
|CheckInterval|The interval, in minutes, that the EventBridge schedule will trigger the Lambda function. The default is 15 minutes.|
103103
|CreateCloudWatchAlarm|Set to "true" if you want to create a CloudWatch alarm, and accompanying Lambda function, that will alert you if the monitoring Lambda function fails.|
104104
|CreateSecretsManagerEndpoint|Set to "true" if you want to create a Secrets Manager endpoint. **NOTE:** If a SecretsManager Endpoint already exist for the specified Subnet the endpoint creation will fail, causing the entire CloudFormation stack to fail. Please read the [Endpoints for AWS services](#endpoints-for-aws-services) for more information.|
105+
|CreateSNSEndpoint|Set to "true" if you want to create an SNS endpoint. **NOTE:** If a SNS Endpoint already exist for the specified Subnet the endpoint creation will fail, causing the entire CloudFormation stack to fail. Please read the [Endpoints for AWS services](#endpoints-for-aws-services) for more information.|
105106
|CreateCWEndpoint|Set to "true" if you want to create a CloudWatch endpoint. **NOTE:** If a CloudWatch Endpoint already exist for the specified Subnet the endpoint creation will fail, causing the entire CloudFormation stack to fail. Please read the [Endpoints for AWS services](#endpoints-for-aws-services) for more information.|
106107
|CreateS3Endpoint|Set to "true" if you want to create an S3 endpoint. **NOTE:** If a S3 Gateway Endpoint already exist for the specified VPC the endpoint creation will fail, causing the entire CloudFormation stack to fail. Note that this will be a "Gateway" type endpoint, since they are free to use. Please read the [Endpoints for AWS services](#endpoints-for-aws-services) for more information.|
107108
|RoutetableIds|The route table IDs to update to use the S3 endpoint. Since the S3 endpoint is of type `Gateway` route tables have to be updated to use it. This parameter is only needed if you are creating an S3 endpoint.|
108109
|VpcId|The ID of a VPC where the subnets provided above are located. Required if you are creating an endpoint, not needed otherwise.|
109110
|EndpointSecurityGroupIds|The security group IDs that the endpoint will be attached to. The security group must allow traffic over TCP port 443 from the Lambda function. This is required if you are creating an Lambda, CloudWatch or SecretsManager endpoint.|
110-
|watchdogRoleArn|The ARN of the role that the Lambda function that the Watchdog CloudWatch alert will use to send SNS alerts if something goes wrong with the monitoring Lambda function. The only required permission is to publish to the SNS topic listed above, although highly recommended that you also add the AWS managed "AWSLambdaBasicExecutionRole" policy that allows the Lambda function to create and write to a CloudWatch log stream so it can provide diagnostic output of something goes wrong. Only required if creating a CloudWatch alert and you want to provide your own role. If left blank a role will be created for you if needed.|
111111
|LambdaRoleArn|The ARN of the role that the Lambda function will use. This role must have the permissions listed in the [Create an AWS Role](#create-an-aws-role) section below. If left blank a role will be created for you.|
112112
|SchedulerRoleArn|The ARN of the role that the EventBridge schedule will use to trigger the Lambda function. It just needs the permission to invoke a Lambda function. If left blank a role will be created for you.|
113-
|CloudWatchRoleArn|The ARN of the role that the will be assigned to the Lambda function that will publish messages to an SNS topic. It just needs the permission to publish to the SNS topic. If left blank, and you CreateCloudWatchAlarm is set to "true", a role will be created for you.|
113+
|watchdogRoleArn|The ARN of the role that the Lambda function that the Watchdog CloudWatch alert will use to send SNS alerts if something goes wrong with the monitoring Lambda function. The only required permission is to publish to the SNS topic listed above, although highly recommended that you also add the AWS managed "AWSLambdaBasicExecutionRole" policy that allows the Lambda function to create and write to a CloudWatch log stream so it can provide diagnostic output of something goes wrong. Only required if creating a CloudWatch alert and you want to provide your own role. If left blank a role will be created for you if needed.|
114114

115115
The remaining parameters are used to create the matching conditions configuration file, which specify when the program will send an alert.
116116
You can read more about it in the [Matching Conditions File](#matching-conditions-file) section below. All these parameters have reasonable default values

Monitoring/monitor-ontap-services/cloudformation.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Metadata:
1919
- checkInterval
2020
- createWatchdogAlarm
2121
- createSecretsManagerEndpoint
22-
- createLambdaEndpoint
22+
- createSNSEndpoint
2323
- createCloudWatchLogsEndpoint
2424
- createS3Endpoint
2525
- routeTableIds
@@ -110,8 +110,8 @@ Parameters:
110110
Default: "false"
111111
AllowedValues: ["true", "false"]
112112

113-
createLambdaEndpoint:
114-
Description: "Create an Lambda endpoint."
113+
createSNSEndpoint:
114+
Description: "Create an SNS endpoint."
115115
Type: String
116116
Default: "false"
117117
AllowedValues: ["true", "false"]
@@ -271,7 +271,7 @@ Parameters:
271271

272272
Conditions:
273273
CreateSecretsManagerEndpoint: !Equals [!Ref createSecretsManagerEndpoint, "true"]
274-
CreateLambdaEndpoint: !Equals [!Ref createLambdaEndpoint, "true"]
274+
CreateSNSEndpoint: !Equals [!Ref createSNSEndpoint, "true"]
275275
CreateS3Endpoint: !Equals [!Ref createS3Endpoint, "true"]
276276
CreateCloudWatchLogsEndpoint: !Equals [!Ref createCloudWatchLogsEndpoint, "true"]
277277
CreateWatchdogAlarm: !Equals [!Ref createWatchdogAlarm, "true"]
@@ -303,12 +303,12 @@ Resources:
303303
SubnetIds: !Ref subNetIds
304304
SecurityGroupIds: !Ref endpointSecurityGroupIds
305305

306-
LambdaEndpoint:
306+
SNSEndpoint:
307307
Type: AWS::EC2::VPCEndpoint
308-
Condition: CreateLambdaEndpoint
308+
Condition: CreateSNSEndpoint
309309
Properties:
310310
VpcId: !Ref vpcId
311-
ServiceName: !Sub "com.amazonaws.${AWS::Region}.lambda"
311+
ServiceName: !Sub "com.amazonaws.${AWS::Region}.sns"
312312
VpcEndpointType: 'Interface'
313313
PrivateDnsEnabled: true
314314
SubnetIds: !Ref subNetIds
@@ -593,6 +593,7 @@ Resources:
593593
Code:
594594
ZipFile: |
595595
#!/bin/python3
596+
#
596597
################################################################################
597598
# THIS SOFTWARE IS PROVIDED BY NETAPP "AS IS" AND ANY EXPRESS OR IMPLIED
598599
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -612,8 +613,8 @@ Resources:
612613
# "matching conditions." It is intended to be run as a Lambda function, but
613614
# can be run as a standalone program.
614615
#
615-
# Version: v2.1
616-
# Date: 2025-05-20-01:22:58
616+
# Version: v2.16
617+
# Date: 2025-05-19-21:24:55
617618
################################################################################
618619
619620
import json

Monitoring/monitor-ontap-services/monitor_ontap_services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/python3
2+
#
23
################################################################################
34
# THIS SOFTWARE IS PROVIDED BY NETAPP "AS IS" AND ANY EXPRESS OR IMPLIED
45
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

0 commit comments

Comments
 (0)