Coder Social home page Coder Social logo

cdk-watchful's Introduction

cdk-watchful

Release python typescript

Watching your CDK back since 2019

Watchful is an AWS CDK construct library that makes it easy to monitor CDK apps. It automatically synthesizes alarms and dashboards for supported AWS resources.

TypeScript:

import { Watchful } from 'cdk-watchful'

const wf = new Watchful(this, 'watchful');
wf.watchDynamoTable('My Cute Little Table', myTable);
wf.watchLambdaFunction('My Function', myFunction);
wf.watchApiGateway('My REST API', myRestApi);

Python:

from cdk_watchful import Watchful

wf = Watchful(self, 'watchful')
wf.watch_dynamo_table('My Cute Little Table', my_table)
wf.watch_lambda_function('My Function', my_function)
wf.watch_api_gateway('My REST API', my_rest_api)

And...

Install

TypeScript/JavaScript:

$ npm install cdk-watchful

Python:

$ pip install cdk-watchful

Initialize

To get started, just define a Watchful construct in your CDK app (code is in TypeScript, but python will work too). You can initialize using an email address, SQS arn or both:

TypeScript:

import { Watchful } from 'cdk-watchful'
import sns = require('@aws-cdk/aws-sns');
import sqs = require('@aws-cdk/aws-sqs');

const alarmSqs = sqs.Queue.fromQueueArn(this, 'AlarmQueue', 'arn:aws:sqs:us-east-1:444455556666:alarm-queue')
const alarmSns = sns.Topic.fromTopicArn(this, 'AlarmTopic', 'arn:aws:sns:us-east-2:444455556666:MyTopic');

const wf = new Watchful(this, 'watchful', {
  alarmEmail: '[email protected]',
  alarmSqs,
  alarmSns,
  alarmActionArns: [ 'arn:aws:sqs:us-east-1:444455556666:alarm-queue' ]
});

Python:

from cdk_watchful import Watchful

alarm_sqs = sqs.Queue.from_queue_arn(self, 'AlarmQueue', 'arn:aws:sqs:us-east-1:444455556666:alarm-queue')
alarm_sns = sns.Topic.from_topic_arn(self, 'AlarmTopic', 'arn:aws:sns:us-east-2:444455556666:MyTopic')

wf = Watchful(
  self,
  'watchful',
  alarm_email='[email protected]',
  alarm_sqs=alarm_sqs,
  alarm_sns=alarm_sns
  alarm_action_arns=['arn:aws:sqs:us-east-1:444455556666:alarm-queue']

Add Resources

Watchful manages a central dashboard and configures default alarming for:

  • Amazon DynamoDB: watchful.watchDynamoTable
  • AWS Lambda: watchful.watchLambdaFunction
  • Amazon API Gateway: watchful.watchApiGateway
  • Request yours

Watching Scopes

Watchful can also watch complete CDK construct scopes. It will automatically discover all watchable resources within that scope (recursively), add them to your dashboard and configure alarms for them.

TypeScript:

wf.watchScope(storageLayer);

Python:

wf.watch_scope(storage_layer)

API Reference

See API.md.

Example

See a more complete example.

Contributing

Contributions of all kinds are welcome and celebrated. Raise an issue, submit a PR, do the right thing.

To set up a dev environment:

  1. Clone this repo
  2. yarn

Development workflow (change code and run tests automatically):

yarn test:watch

Build (like CI):

yarn build

Release new versions:

yarn bump

And then publish as a PR.

License

Apache 2.0

cdk-watchful's People

Contributors

aminfazlmondo avatar andrea-lascola avatar aws-cdk-automation avatar ayush987goyal avatar cdklabs-automation avatar corymhall avatar dependabot[bot] avatar eladb avatar elthrasher avatar github-actions[bot] avatar iliapolo avatar jatin7gupta avatar losnappas avatar mark-ship-it avatar maskerade avatar mbeacom avatar mergify[bot] avatar mrarnoldpalmer avatar mwiarda avatar njlynch avatar pgollucci avatar romainmuller avatar seawatts avatar voho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.