Moogsoft Docs

AWS SNS

To integrate with AWS Simple Notification Service (SNS), you can configure a Lambda function to post data when CloudWatch triggers an alarm.

See the AWS SNS documentation for details on invoking Lambda functions using AWS SNS.

Before You Begin

The AWS SNS integration has been validated with AWS SNS v. 2016-06-28. Before you start to set up your AWS SNS integration, ensure you have met the following requirements:

  • You have an active AWS account.
  • You have the necessary permissions to create Lambda functions and SNS topics within AWS.
  • You have configured AWS SNS topics for your CloudWatch alarms.
  • AWS SNS can make requests to external endpoints over port 443. This is the default.

Configure the AWS SNS Integration

Configure the AWS SNS integration in Moogsoft AIOps as follows:

  1. Navigate to the Integrations tab.
  2. Click AWS SNS in the Monitoring section.
  3. Follow the instructions to create an integration name.

Configure AWS SNS

To create a Lambda function to trigger on an SNS topic, follow the steps below. For more help, see the AWS SNS Documentation .

  1. Create a role in AWS with the following properties:

    Field
    Value
    Type AWS ser vice
    Service Lambda
    Policies

    These two policies are required as a minimum:

    AmazonEC2ReadOnlyAccess
    AWSLambdaExecute

  2. Create a Lambda function with the following properties:

    Field Value
    Name lam bdaToMoog
    Runtime Node.js 8.10
    Role Select the role you created in step 1
  3. Add an SNS trigger to your Lambda function and select the topics to trigger the function.

  4. Download the SNS integration Lambda function zip file here .
  5. Upload the zip file in the function code section of the lambToMoog configuration.

    Note

    Unapproved changes to the code are unsupported. Submit any changes to Moogsoft for review.

  6. Configure the environment variables for the lambToMoog function as follows:

    Key Value
    MOOG_URL

    <your AWS SNS integration URL>

    For example: https://example.moogsoftaiops.com/events/sns_awssns1

    MOOG_USER Username generated in the Moogsoft AIOps UI.
    MOOG_PASS Password generated in the Moogsoft AIOps UI.
  7. Save the function.

Test AWS SNS

You can test the AWS SNS configuration using the following example test event .

Note

JSON is the only supported format for AWS SNS messages.

{
  "Records": [
    {
      "EventSource": "aws:sns",
      "EventVersion": "1.0",
      "EventSubscriptionArn": "arn:aws:sns:us-east-1:347584378564:test-notifications:fe1a2b3c-ab11-1234-a12b-108a1abc1234",
      "Sns": {
        "Type": "Notification",
        "MessageId": "1ab123a1-1a01-12ab-a1b2-12aa0a1abc1a",
        "TopicArn": "arn:aws:sns:us-east-1:347584378564:test-notifications",
        "Subject": "OK: \"Dynatrace EC2 Instance CPU\" in US East (N. Virginia)",
        "Message": "{\"AlarmName\":\"Dynatrace EC2 Instance CPU\",\"AlarmDescription\":\"Dynatrace EC2 Instance Monitoring\",\"AWSAccountId\":\"123412341234\",\"NewStateValue\":\"OK\",\"NewStateReason\":\"Sample SNS integration test event.\",\"StateChangeTime\":\"2018-02-27T16:19:41.353+0000\",\"Region\":\"US East (N. Virginia)\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"MetricName\":\"CPUUtilization\",\"Namespace\":\"AWS/EC2\",\"StatisticType\":\"Statistic\",\"Statistic\":\"AVERAGE\",\"Unit\":null,\"Dimensions\":[{\"name\":\"InstanceId\",\"value\":\"i-123a1abcdef0a012a\"}],\"Period\":300,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanOrEqualToThreshold\",\"Threshold\":10.0,\"TreatMissingData\":\"- TreatMissingData:                    Breaching\",\"EvaluateLowSampleCountPercentile\":\"\"}}",
        "Timestamp": "2018-02-27T16:19:41.392Z",
        "SignatureVersion": "1",
        "Signature": "signature",
        "SigningCertUrl": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-1234.pem",
        "UnsubscribeUrl": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:347584378564:test-notifications:fe1a2b3c-ab11-1234-a12b-108a1abc1234",
        "MessageAttributes": {}
      }
    }
  ]
}

After you complete the AWS SNS configuration your CloudWatch alarms are forwarded to Moogsoft AIOps.