cdk-cloudwatch-alarm-chatbot-1.0.9
توضیحات
cdk-cloudwatch-alarm-chatbot
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cdk-cloudwatch-alarm-chatbot-1.0.9 |
| نام | cdk-cloudwatch-alarm-chatbot |
| نسخه کتابخانه | 1.0.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Lorenz Vanthillo<lorenz.vanthillo@gmail.com> |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/lvthillo/cdk-cloudwatch-alarm-chatbot.git |
| آدرس اینترنتی | https://pypi.org/project/cdk-cloudwatch-alarm-chatbot/ |
| مجوز | Apache-2.0 |
[](https://badge.fury.io/js/cdk-cloudwatch-alarm-chatbot)
[](https://badge.fury.io/py/cdk-cloudwatch-alarm-chatbot)

# cdk-cloudwatch-alarm-chatbot
A CDK construct which creates an SNS AWS ChatBot (Slack) integration for CloudWatch alarms.
# Example
Example use of construct
```python
import * as cdk from 'aws-cdk-lib';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
import * as cloudwatch_actions from 'aws-cdk-lib/aws-cloudwatch-actions';
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { CdkCloudWatchAlarmChatBot } from 'cdk-cloudwatch-alarm-chatbot';
import { Construct } from 'constructs';
export class CdkDemoStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const queue = new sqs.Queue(this, 'HelloCdkQueue', {
visibilityTimeout: cdk.Duration.seconds(300)
});
const qMetric = queue.metric('ApproximateNumberOfMessagesVisible');
const alarm = new cloudwatch.Alarm(this, 'Alarm', {
metric: qMetric,
threshold: 100,
evaluationPeriods: 3,
datapointsToAlarm: 2
});
const slackAlarmIntegration = new CdkCloudWatchAlarmChatBot(this, 'SlackIntegration', {
topicName: 'slack-alarm',
slackChannelId: 'xxx',
slackWorkSpaceId: 'yyy',
});
alarm.addAlarmAction(new cloudwatch_actions.SnsAction(slackAlarmIntegration.topic));
}
}
```
Test Alarm:
```
$ aws cloudwatch set-alarm-state --alarm-name "xxx" --state-value ALARM --state-reason "testing purposes"
```
نیازمندی
| مقدار | نام |
|---|---|
| <3.0.0,>=2.1.0 | aws-cdk-lib |
| <11.0.0,>=10.0.5 | constructs |
| <2.0.0,>=1.69.0 | jsii |
| >=0.0.3 | publication |
| ~=2.13.3 | typeguard |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ~=3.7 | Python |
نحوه نصب
نصب پکیج whl cdk-cloudwatch-alarm-chatbot-1.0.9:
pip install cdk-cloudwatch-alarm-chatbot-1.0.9.whl
نصب پکیج tar.gz cdk-cloudwatch-alarm-chatbot-1.0.9:
pip install cdk-cloudwatch-alarm-chatbot-1.0.9.tar.gz