{"id":19274019,"url":"https://github.com/sbstjn/serverless-sqs-alarms-plugin","last_synced_at":"2025-04-21T22:33:28.411Z","repository":{"id":57356780,"uuid":"86804466","full_name":"sbstjn/serverless-sqs-alarms-plugin","owner":"sbstjn","description":"Serverless wrapper to setup CloudWatch Alarms for SQS","archived":false,"fork":false,"pushed_at":"2020-10-12T23:31:19.000Z","size":61,"stargazers_count":36,"open_issues_count":6,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T16:24:23.412Z","etag":null,"topics":["aws","lambda","plugin","serverless","sns","sqs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/serverless-sqs-alarms-plugin","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbstjn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-31T09:51:31.000Z","updated_at":"2023-01-11T00:27:38.000Z","dependencies_parsed_at":"2022-09-26T16:32:02.376Z","dependency_job_id":null,"html_url":"https://github.com/sbstjn/serverless-sqs-alarms-plugin","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Fserverless-sqs-alarms-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Fserverless-sqs-alarms-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Fserverless-sqs-alarms-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbstjn%2Fserverless-sqs-alarms-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbstjn","download_url":"https://codeload.github.com/sbstjn/serverless-sqs-alarms-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250000871,"owners_count":21358817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","lambda","plugin","serverless","sns","sqs"],"created_at":"2024-11-09T20:44:49.980Z","updated_at":"2025-04-21T22:33:23.391Z","avatar_url":"https://github.com/sbstjn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚡️ Serverless Plugin for SQS CloudWatch Alarms\n\n[![npm](https://img.shields.io/npm/v/serverless-sqs-alarms-plugin.svg)](https://www.npmjs.com/package/serverless-sqs-alarms-plugin)\n[![CircleCI](https://img.shields.io/circleci/project/github/sbstjn/serverless-sqs-alarms-plugin.svg)](https://circleci.com/gh/sbstjn/serverless-sqs-alarms-plugin)\n[![license](https://img.shields.io/github/license/sbstjn/serverless-sqs-alarms-plugin.svg)](https://github.com/sbstjn/serverless-sqs-alarms-plugin/blob/master/LICENSE.md)\n[![Coveralls](https://img.shields.io/coveralls/sbstjn/serverless-sqs-alarms-plugin.svg)](https://coveralls.io/github/sbstjn/serverless-sqs-alarms-plugin)\n\n## About the plugin\n\nThis serverless plugin is a wrapper to configure CloudWatch Alarms to monitor the visible messages in an SQS queue. You need to provide the SQS *queue name* and SNS *topic* which will receive the `Alarm` and `OK` messages.\n\n## Usage\n\nAdd the npm package to your project:\n\n```bash\n# Via yarn\n$ yarn add serverless-sqs-alarms-plugin\n\n# Via npm\n$ npm install serverless-sqs-alarms-plugin --save\n```\n\nAdd the plugin to your `serverless.yml`:\n\n```yaml\nplugins:\n  - serverless-sqs-alarms-plugin\n```\n\nConfigure alarms in `serverless.yml`:\n\n```yaml\ncustom:\n  sqs-alarms:\n    - queue: your-sqs-queue-name\n      topic: your-sns-topic-name\n      name: your-alarm-name # optional parameter\n      thresholds:\n        - 1\n        - 50\n        - 100\n        - 500\n      treatMissingData: string | array[] # optional parameter\n```\n\n\u003e 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 …](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data)\n\nThat's it! With this example your SNS topic will receive a message when there are more than 1, 50, 100, and 500 visible in SQS.\n\n## CloudWatch Alarms\n\nThe created CloudWatch Alarms look like this:\n\n```json\n{\n  \"Type\": \"AWS::CloudWatch::Alarm\",\n  \"Properties\": {\n    \"AlarmDescription\": \"Alarm if queue contains more than 100 messages\",\n    \"Namespace\": \"AWS/SQS\",\n    \"MetricName\": \"ApproximateNumberOfMessagesVisible\",\n    \"Dimensions\": [\n      {\n        \"Name\": \"QueueName\",\n        \"Value\": \"your-sqs-queue-name\"\n      }\n    ],\n    \"Statistic\": \"Sum\",\n    \"Period\": 60,\n    \"EvaluationPeriods\": 1,\n    \"Threshold\": 100,\n    \"ComparisonOperator\": \"GreaterThanOrEqualToThreshold\",\n    \"AlarmActions\": [\n      { \"Fn::Join\": [ \"\", [ \"arn:aws:sns:eu-west-1:\", { \"Ref\": \"AWS::AccountId\" }, \":your-sns-topic-name\" ] ] }\n    ],\n    \"OKActions\": [\n      { \"Fn::Join\": [ \"\", [ \"arn:aws:sns:eu-west-1:\", { \"Ref\": \"AWS::AccountId\" }, \":your-sns-topic-name\" ] ] }\n    ]\n  }\n}\n```\n\n## License\n\nFeel free to use the code, it's released using the [MIT license](https://github.com/sbstjn/serverless-sqs-alarms-plugin/blob/master/LICENSE.md).\n\n## Contribution\n\nFeel free to contribute to this project! Thanks 😘\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbstjn%2Fserverless-sqs-alarms-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbstjn%2Fserverless-sqs-alarms-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbstjn%2Fserverless-sqs-alarms-plugin/lists"}