Home

Awesome

Serverless SQS CloudWatch Alarms Plugin

serverless NPM version digitalmaas NPM downloads CircleCI

A Serverless plugin that simplifies the setup of CloudWatch Alarms to monitor the visible messages in an SQS queue.

Installation

From your target serverless project, run:

$ npm install --save-dev @digitalmaas/serverless-plugin-sqs-alarms

Add the plugin to your serverless.yml:

plugins:
  - '@digitalmaas/serverless-plugin-sqs-alarms'

Configuration

Configure alarms in serverless.yml:

custom:
  sqsAlarms:
    - name: your-alarm-name           # optional, unless your queue is a reference (e.g. `Ref`)
      queue: your-sqs-queue-name
      topic: your-sns-topic-name      # references can used, e.g. `Ref`, `Fn::ImportValue`
      treatMissingData: breaching     # optional, <ignore|missing|breaching|notBreaching>
      evaluationPeriods: 1            # optional, default 1
      period: 60                      # optional, default 60
      thresholds:
        - 1
        - 50
        - value: 500
          period: 300                 # optional, overrides upper level config
          evaluationPeriods: 1        # optional, overrides upper level config
          treatMissingData: ignore    # optional, overrides upper level config

The treatMissingData setting can be a string which is applied to all alarms, or an array to configure alarms individually. Valid types are ignore, missing, breaching, notBreaching (more details in the AWS docs).

In the example above, your SNS topic would receive a message when there are more than 1, 50, and 500 visible in SQS.

More Info

License

MIT License.

This project has been forked from the original serverless-sqs-alarms-plugin and published under a different name, as the original has been abandoned.

For the complete information, please refer to the license file.