Giter Club home page Giter Club logo

aws-to-slack's Introduction

AWS-to-Slack

npm license dependencies

Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.

CloudWatch Example EB Event Example
CloudWatch Alarm Example Elastic Beanstalk Example

What is it?

AWS-to-Slack is a Lambda function written in Node.js that forwards alarms and notifications to a dedicated Slack channel. It is self-hosted in your own AWS environment and doesn't have any 3rd party dependencies other than the Google Charts API for rendering CloudWatch metrics.

Supported AWS product notification formats:

  • Auto-Scaling Events
  • Batch Events
  • CloudFormation
  • CloudWatch Alarms (incl. Metrics!)
  • CodeBuild
  • CodeCommit
  • CodeDeploy ๐Ÿ†• (via SNS/CloudWatch)
  • CodePipeline ๐Ÿ†• (via SNS/CloudWatch)
  • CodePipeline Manual Approval ๐Ÿ†•
  • Elastic Beanstalk
  • GuardDuty ๐Ÿ†•
  • Health Dashboard
  • Inspector
  • RDS
  • SES Received Notifications
  • Generic SNS messages
  • Plain text messages

Additional formats will be added. Pull Requests are welcome!

Try!

Ready to try the latest version for yourself? Installation into your own AWS environment is simple:

Option 1: Quick Start (OLD CODE)

Launch CloudFormation Stack

Warning! The template referenced by this link is an old template and old code! If you want the latest version of this repo, you need to update the Lambda code after it's launched.

Option 2: Get the latest bug fixes

  1. Download this repo locally.

  2. Use AWS Console's Create CloudFormation Stack tool.

    Upload cloudformation.yaml as your template.

  3. Finish launching the Stack.

    For details on the parameter values, see Installation section.

  4. Build / Update the code by running the following from the root of this project:

    AWS_REGION="<your_lambda_region>" LAMBDA_NAME="<your_lambda_name>" make deploy
    

    If you use AWS CLI profiles, simply add AWS_PROFILE to the make command like so:

    AWS_PROFILE="my-profile" AWS_REGION="<your_lambda_region>" LAMBDA_NAME="<your_lambda_name>" make deploy
    

Option 3: Use deploy target

See Managing Multiple Deployments for a .env file approach to creating or managing multiple stacks.

Installation

Step 1: Setup Slack

The Lambda function communicates with Slack through a Slack webhook webhook. Note that you can either create an app, or a custom integration > Incoming webhook (easier, will only let you add a webhook)

  1. Navigate to https://my.slack.com/apps/manage and click "Add Configuration".
  2. Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration".
  3. Copy the webhook URL from the setup instructions and use it in the next section.
  4. Click "Save Settings" at the bottom of the Slack integration page.

Slack Configuration

Step 2: Configure & Launch the CloudFormation Stack

Note that the AWS region will be the region from which you launch the CloudFormation wizard, which will also scope the resources (SNS, etc.) to that region.

Launch the CloudFormation Stack by using our preconfigured CloudFormation template and following the steps above.

Afterwards

Click "Next" and on the following page name your new stack and paste the webhook URL from before into the "HookUrl" field. You can also configure a different channel to post to if wanted.

AWS CloudFormation Configuration

Click "Next" again, complete the stack setup on the following pages and finally launch your stack.

Step 3: Subscribe to Triggers

Before the Lambda function will actually do anything you need to subscribe it to actual CloudWatch alarms and other SNS triggers. Open up the AWS Lambda, switch to the "Triggers" tab and subscribe for all events you're interested in.

Lambda Triggers

Setting Up AWS CodeBuild

CodeBuild integration was suggested by ericcj and is based on the Medium post Monitor your AWS CodeBuilds via Lambda and Slack by Randy Findley.

To enable CodeBuild notifications add a new CloudWatch Event Rule, choose CodeBuild as source and CodeBuild Build State Change as type. As Target select the aws-to-slack Lambda. You can leave all other settings as is. Once your rule is created all CodeBuild build state events will be forwarded to your Slack channel.

Setting Up AWS CodeCommit

Similar to the CodeBuild integration, CodeCommit notifications are triggered by CloudWatch Event Rules. Create a new CloudWatch Event Rule, select CodeCommit as the source, and select one of the supported event types:

  • CodeCommit Pull Request State Change - Will generate events when a pull request is opened, closed, merged, or updated.
  • CodeCommit Repository State Change - Will generate events when a branch or tag reference is created, updated, or deleted.

Add the aws-to-slack lambda as the target. No other settings are needed.

Managing Multiple Deployments

You can save local .env files that contain your stack configurations for easier deployment and updates. Copy targets/example.env to a separate file and customize the parameters. Then deploy the file like this:

TARGET=targets/my-deploy.env make deploy

If you want to force-compile this project and push your code to a stack, use this:

TARGET=targets/my-deploy.env make package deploy

If you need to update your CloudFormation parameters, try this:

TARGET=targets/my-deploy.env make update-stack

Contributing

You want to contribute? That's awesome! ๐ŸŽ‰

Check out our issues page for some ideas how to contribute and a list of open tasks. There're plenty of notification formats that still need to be supported.

The repository comes with a very simple Makefile to build the CloudFormation stack yourself.

make package

This generates a new release.zip in the root folder. Upload this zip to your AWS Lambda function and you're good to go. Make sure to check out Managing Multiple Deployments for a more scalable solution to deploys.

aws-to-slack's People

Contributors

alberts-s avatar arabold avatar barneyjm avatar bkono avatar dependabot[bot] avatar devhops avatar elchaposing avatar greyvugrin avatar gsoyka avatar homeyjd avatar iamandrewluca avatar lorengordon avatar ppalazon avatar startouf avatar stevemac007 avatar techypaul avatar thesuavehog avatar yasuoza avatar zoobinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-to-slack's Issues

Charts for pNN.NN Metrics fail to generate

Many of my alarms are using p99 statistics, and those seem to be causing the chart to fail with an error:

Error rendering chart: { InvalidParameterValue: The parameter Statistics.member.1 must be a value in the set [ Minimum, Maximum, Average, SampleCount, Sum ]

Have you seen https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricWidgetImage.html? Its not in the aws-sdk that comes in Lambda's Node runtime, but I think could be worth considering

Kudos

This is a really nice project and super easy to use. THANKS!!

Codebase version in the yaml template ?

Is this where the codebase is defined ?

Code:
        S3Bucket: !Sub 'aws-to-slack-${AWS::Region}'
        S3Key: release.zip

When launching the template, I do not get the latest version of the code. Has this been updated for all regions ?
If I'm supposed to update the function code some other way, how to proceed ?

Support different slack channels per aws service

Hi I love what you have built here and recently set up a codebuild notification pipeline with ease. I was hoping there was a way to support sending messages to different slack hook urls on a per service basis, i.e. send codedeploy messages to a different channel. I could work on writing the code myself or if theres a way to do this already then please advise.

Update dependencies

Helo gentlemen!
I found this project by change on my searches and I'm interested in using it, but when I ran make package I got this:

found 71 vulnerabilities (62 low, 2 moderate, 7 high) in 17893 scanned packages
  run `npm audit fix` to fix 2 of them.
  69 vulnerabilities require semver-major dependency updates.

Any plans to update these dependencies to fix the security vulnerabilities?

Full output:

$ npm audit

                       === npm audit security report ===

# Run  npm install --save-dev [email protected]  to resolve 69 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change

   [[[ snipping long output ]]]

found 71 vulnerabilities (62 low, 2 moderate, 7 high) in 17893 scanned packages
  run `npm audit fix` to fix 2 of them.
  69 vulnerabilities require semver-major dependency updates.

Not showing Commit message in CWLogs or Slack

Using a CloudWatch Rule to send CodeCommit changes, I see the below on the Slack Message;

Commit Message
Could not inspect repository. Check logs for stack trace.

And in the CloudWatch Logs for the Function the following:

Failed to inspect branch: { TimeoutError: Socket timed out without establishing a connection at Timeout.connectTimeout

Is this a permissions issue or something else?

Support for other regions than us-east-1

I'm getting the following errors during creation of the lambda function

Error occurred while GetObject. S3 Error Code: PermanentRedirect. S3 Error Message: The bucket is in this region: us-east-1. Please use this region to retry the request (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: c95cbacf-968e-11e8-8f09-ff64c1332048)
--

Seems like the code can't be installed in other regions ?

Issue with signin link in message footer

screen shot 2019-01-26 at 2 37 24 pm

It seems like the footer text is being truncated before the link is parsed, and ends up looking like this for me.

Would you be open to a PR to remove the signin link from this footer?

Add release.zip to the 1.2.x releases

Hi,

the 1.1.x releases had an release.zip already present with the required dependencies in the build directory. Would it be possible to add it to the 1.2.x releases as well?

Thanks.

Slack running out of memory/timeout

We are currently seeing an issue with aws2slack where Lambdas would fail due to timeouts (30s). It seems this is somehow related to memory consumption as it will use all available memory at this point:

`06:26:20REPORT RequestId: 4a1e0e6e-5bd7-4951-b3df-b701d8e5d8a5 Duration: 30030.25 ms Billed Duration: 30000 ms Memory Size: 256 MB Max Memory Used: 256 MB

06:26:20 2019-06-12T06:26:20.256Z 4a1e0e6e-5bd7-4951-b3df-b701d8e5d8a5 Task timed out after 30.03 seconds`

sometimes also this message is logged:

`06:27:34 REPORT RequestId: 4a1e0e6e-5bd7-4951-b3df-b701d8e5d8a5 Duration: 18887.18 ms Billed Duration: 18900 ms Memory Size: 256 MB Max Memory Used: 257 MB

06:27:34 RequestId: 4a1e0e6e-5bd7-4951-b3df-b701d8e5d8a5 Error: Runtime exited with error: signal: killed Runtime.ExitError`

It happens quite often, however in between there are successful calls.

Any idea what could cause the timeout and the high memory consumption?

EDIT: Same input works when running locally...

Transition to async/await

@arabold Thank you for creating such an easy-to-read and incredibly useful repo!

I have need of Slack integration on several AWS projects. I will be extending this in 2019 to include:

  • Auto-Scaling messages
  • ECS deploy messages
  • add AWS Console link URLs so message titles become clickable
  • extend CloudFormation template with option to create global CloudWatch Alarms for smaller projects

AWS Lambda now supports Node v8.10.

In my other projects my team has really benefited from the easier reasoning/reading that comes with the async/await pattern. BlueBird is a solid and performant library and I think a perfect choice when you created this repo. I think for my purposes, the easier reasoning is worth a couple more hours to re-write the code into native async/await. I'm hoping with the Node-core team committing to the async/await keywords, that the pattern will live longer than any single library might.

Of course this would be a large change for this repo.
Would you be open to a Pull Request this large, or would you prefer I keep my work separate?

Cloudwatch Events Integrations [Feature Request]

Hey Team,

Can you guide me to build the cloud watch events something like SPOT Instance termination events to come in Slack channel?.

Currently, It just works as generic events, but I would like to get bare minimum tags like Instance Name or Instance type and AZ name.

Current notification to Slack.

aws.ec2 (ap-southeast-1 - XXXXXX)
EC2 Instance State-change Notification
version
0
id
e88ed778-8861-7f63-b63c-089cbb569a17
resources
["arn:aws:ec2:ap-southeast-1:XXXX:instance/i-047dd4e31a66a990b"]
detail
{"instance-id":"i-047dd4e31a66a990b","state":"terminated"}```

Desired Notification

aws.ec2 (ap-southeast-1 - XXXXXX)
EC2 Instance State-change Notification
SPOT Instance State change : Name: foo-bar in region az and reason for it ??
Instance ID: i-047dd4e31a66a990b
State Change
STATE โ†’ TERMINATED
Region
Asia Pacific (Singapore)




Zip file

Hello.. This is great!

Btw, do you have the zipfile for the CF template? It doesn't seems to work on me because I tried to build in a different region.

TIA.

1.1.9 release.zip on S3 not applying formatting to CodePipeline messages

https://s3.amazonaws.com/aws-to-slack-us-east-1/release.zip results in the behavior noted in my comment.

I tried building from d9ca09c and uploading that as
@homeyjd suggested.

The build artifact resulted in an error in CloudWatch:

Syntax error in module 'src/index': SyntaxError async processEvent(event) { ^^^^^^^^^^^^ SyntaxError: Unexpected identifier at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) 

@homeyjd, is there a different git commit that I can try? I also want to test building on a different machine just to rule out my build environment.

Resultant local build zip: release.zip

build output
make-package-output.log

[edited for clarity, length and readability]

Cannot get the system to pick up change of states in custom cloudwatch alarms

I'm not sure if the issue is in my definition of the alarms (CPU utilization goes above a certain threshold for x minutes for a specific instance) or if it's just not possible with this tool but I have tried to use the below input as CloudWatch events in my handler :

{
  "source": [
    "aws.events"
  ]
}

But i'm not getting any results in the slack app. Would appreciate it if someone could point me to what I'm supposed to look for.

lodash module error using run time nodejs10.x

With the recent announcement about the depreciation of Node.js 8.10, at the end of the year, I tested this using the Nodejs10.x run time, and am receiving the following error when it executes the function:

{ "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'lodash'", "trace": [ "Runtime.ImportModuleError: Error: Cannot find module 'lodash'", " at _loadUserApp (/var/runtime/UserFunction.js:100:13)", " at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)", " at Object.<anonymous> (/var/runtime/index.js:45:30)", " at Module._compile (internal/modules/cjs/loader.js:778:30)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)", " at Module.load (internal/modules/cjs/loader.js:653:32)", " at tryModuleLoad (internal/modules/cjs/loader.js:593:12)", " at Function.Module._load (internal/modules/cjs/loader.js:585:3)", " at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)", " at startup (internal/bootstrap/node.js:283:19)" ] }

Just wonder if anyone else is seeing this?

How to send just a text message?

I am not sure how I would just have this send out a text message that I can preconfigure?

Is there a variable I should populate?

I want to send a message like "Backup failed" to slack when an alarm is triggered and I have that alarm trigger sns. Nothing fancy needed. How can I use the "Test" feature in Lambda to try this?

Thanks!
Ernie

Formatting not being applied to messages

Should all the notifications for the supported resources come through formatted and coloured? Only, I get all the notifications, but only CloudWatch Alarms (CPU etc) are correctly formatted. All others come through, as what seems to be, the raw json format. I have tried all the supported formats, but can't seem to get them to display nicely.

Example of GuardDuty notifications:
guardduty

AWS Security Hub Findings integration

This is a feature request:
With the AWS Security Hub aggregating security findings from plethora of AWS tools and external providers it'd be great if you had "AWS Security Hub Findings integration".
Is this on the roadmap/eta?

An INCLUDE_AWS_LINKS true/false env var to indicate preferred parser behavior

Many of the parsers assume the Slack receiver has AWS Console access to the resources mentioned and include back-links into AWS. Even generic SNS messages assume the receiver can view/manage SNS topics.

Sometimes the people at the Slack target don't have any access to the AWS resources generating the events. It would be nice to have the option to either

  • have parsers include or omit back-links to AWS (as a per-deployment preference)
  • in that parser list have two parsers for the same event with/without links (first selector decides)

I suggest an INCLUDE_AWS_LINKS environment variable that tells that deployment whether or not including back-links is preferred.

Multiple deployments for different targets works fine, and I can set this global preference so that I don't have to fork the code-base for internal/external audiences. I've implemented something like this to test it out, and could extract a PR later if this is a desirable feature.

'make deploy' adds lines to TARGET file prefixed by '-e'

The Makefile includes some echo -e commands to add to the target file. The -e seems to work and the backslashes get interpreted, but also the '-e' is turning up in the output added to the file. Can't explain that. Any idea?

-e # Makefile on Sat Jul  6 13:04:24 DST 2019
STACK_ID=arn:aws:cloudformation:...
-e # Makefile on Sat Jul  6 13:04:26 DST 2019
LAMBDA_NAME=aws-to-slack-ABCDEFGIJK

echo is working as you'd expect on the command line.

$ echo "Foo\nBar"
Foo\nBar
$ echo -e "Foo\nBar"
Foo
Bar
GNU Make 4.1
GNU bash, version 4.4.19(1)-release

Access Denied To you Launch Stack

When trying to launch a template, says access denied to your s3 bucket. Although I can clone, would rather go straight to the source. Thanks.

Transform issue

HI, I'm getting an issue when trying to create the transforms

Check the following transforms: ["AWS::Serverless-2016-10-31"]
You must use a change set to create this stack because it includes one or more transforms. The change set shows the resources that transforms add to your stack's template. Choose Create Change Set, check the resources that the transforms add, and then choose Execute. Learn more.

Error creating change set: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [Handler] is invalid. 'CodeUri' requires Bucket and Key properties to be specified

I have no clue what to do

Thanks

CodePipeline Notifications Howto

Thanks for this awesome project!

It looks like the CodePipeline parser is set up to parse SNS messages.

I set up CodePipeline events through CloudWatch Events (https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html), not through SNS.

When I have my CloudWatch Event rule trigger the aws-to-slack lambda it just sends the raw message.

Is there another way to do it? It would be great if this could parse Cloudwatch Events for CodePipeline and send nicely formatted Slack notifications.

Cut release?

Time to cut a release? There are 116 commits since the last release, including several new parsers and the async refactor. Feels like maybe it's time, that waiting will just make it harder as the changes build up... ๐Ÿ˜ Thanks!

Template on AWS is not updated for new Node version

Getting this error when trying to launch the stack from the S3 template :

The runtime parameter of nodejs6.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs8.10) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 1184b2c9-7840-11e9-a662-eb416f189a16)

Support for Code Pipeline notifications

CodePipeline sends out events as code moves through the various stages. Adding support for CodePipeline compliments any CodeBuild & CodeDeploy support that already exists.

In particular, CodePipeline supports manual approval steps. Having these notifications pushed to Slack is extremely helpful for ensuring that people see the events and can easily (and quickly respond).

Support for sending Cloudwatch Logs to Slack

I have a cloutwatch logs filter and alarm on certain filter expressions. It would be nice to also send the like containing the filter expression to slack along with the metrics.

Chart image_url is empty string

image_url appears to be empty, so obviously no chart is rendered. The role policy assigned to the lambda does allow for cloudwatch:GetMetricStatistics.

2018-08-23T03:49:19.325Z	834ff060-a687-11e8-b54b-f3bd08db589d	Incoming Message:
{
    "Records": [
        {
            "EventSource": "aws:sns",
            "EventVersion": "1.0",
            "EventSubscriptionArn": "arn:aws:sns:us-east-2:**********:**************-rds-threshold-alerts20180815150821831900000005:6aee2bab-c8e0-465f-934c-77b416215e86",
            "Sns": {
                "Type": "Notification",
                "MessageId": "3af0ec97-5293-53a0-acd2-bf6f626d8cf7",
                "TopicArn": "arn:aws:sns:us-east-2:*************:*************-rds-threshold-alerts20180815150821831900000005",
                "Subject": "ALARM: \"**************-master-rds-cpu-utilization-too-high\" in US East (Ohio)",
                "Message": "{\"AlarmName\":\"**************-master-rds-cpu-utilization-too-high\",\"AlarmDescription\":\"Average database CPU utilization over the last 5 minutes exceeded threshold: ***************-master\",\"AWSAccountId\":\"**********\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 out of the last 1 datapoints [1.8873761229939232 (23/08/18 03:44:00)] was greater than the threshold (1.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\":\"2018-08-23T03:49:18.798+0000\",\"Region\":\"US East (Ohio)\",\"OldStateValue\":\"OK\",\"Trigger\":{\"MetricName\":\"CPUUtilization\",\"Namespace\":\"AWS/RDS\",\"StatisticType\":\"Statistic\",\"Statistic\":\"AVERAGE\",\"Unit\":null,\"Dimensions\":[{\"name\":\"DBInstanceIdentifier\",\"value\":\"************-master\"}],\"Period\":300,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanThreshold\",\"Threshold\":1.0,\"TreatMissingData\":\"- TreatMissingData:                    Ignore\",\"EvaluateLowSampleCountPercentile\":\"\"}}",
                "Timestamp": "2018-08-23T03:49:18.845Z",
                "SignatureVersion": "1",
                "Signature": "*****************+15FcMBh4NJDcl4HFTCPu***********",
                "SigningCertUrl": "https://sns.us-east-2.amazonaws.com/SimpleNotificationService-ac565b8b1a6c5d002d285f9598aa1d9b.pem",
                "UnsubscribeUrl": "https://sns.us-east-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:***********:*************-rds-threshold-alerts20180815150821831900000005:6aee2bab-c8e0-465f-934c-77b416215e86",
                "MessageAttributes": {}
            }
        }
    ]
}


2018-08-23T03:49:21.608Z	834ff060-a687-11e8-b54b-f3bd08db589d	Sending Message to Slack:
{
    "attachments": [
        {
            "fallback": "**************-master-rds-cpu-utilization-too-high state is now ALARM:\nThreshold Crossed: 1 out of the last 1 datapoints [1.8873761229939232 (23/08/18 03:44:00)] was greater than the threshold (1.0) (minimum 1 datapoint for OK -> ALARM transition).",
            "color": "danger",
            "author_name": "Amazon CloudWatch Alarm",
            "title": "***************-master-rds-cpu-utilization-too-high",
            "text": "Threshold Crossed: 1 out of the last 1 datapoints [1.8873761229939232 (23/08/18 03:44:00)] was greater than the threshold (1.0) (minimum 1 datapoint for OK -> ALARM transition).",
            "fields": [
                {
                    "title": "Acount ID",
                    "value": "****************",
                    "short": true
                },
                {
                    "title": "Region",
                    "value": "US East (Ohio)",
                    "short": true
                },
                {
                    "title": "Old State",
                    "value": "OK",
                    "short": true
                },
                {
                    "title": "New State",
                    "value": "ALARM",
                    "short": true
                }
            ],
            "ts": 1534996158,
            "image_url": ""
        }
    ]
}

Parser | - chart.js

Any advice on how to use IAM role for the execution instead of keys or secret? TIA

Error rendering chart

Deploying using serverless and nodejs10.x and getting this in the lambda logs:

2019-08-31T12:56:28.141Z cd3c3e52-1260-4878-82bd-18b7b66dfeb7 INFO Error rendering chart: { InvalidParameterValue: The parameter Statistics.member.1 must be a value in the set [ Minimum, Maximum, Average, SampleCount, Sum ]. at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14) at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12) at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12) at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18) message: 'The parameter Statistics.member.1 must be a value in the set [ Minimum, Maximum, Average, SampleCount, Sum ].', code: 'InvalidParameterValue', time: 2019-08-31T12:56:28.125Z, requestId: 'c7c77eed-a0bc-4714-b2b5-c651316e7e8e', statusCode: 400, retryable: false, retryDelay: 19.789864084998786 }

Any idea what the problem is?

Used the Deploy link - Package doesnt work

So after deploying the template in US-East-1 I created a cloud watch pointed it to the topic pointed the topic to the handler automatic function that was created and added the hook url to the key value on the function but I see no alerts in the slack channel. Not sure what else I am missing to get this at least working than add to the development.

CodeCommit Notifications

I'd like to get slack notifications from CodeCommit Pull Request events. I got this lambda function setup, and it's working, but it's just posting the event json to slack. Figure just need to add a parser, thinking something similar to the CodeBuild parser. I can try to knock this out...

Fails to render Alarm chart: fromTime.getTime is not a function

Hello,

I'm getting:

Error rendering chart: TypeError: fromTime.getTime is not a function

when alarm chart is rendered. Metrics/alarm is custom one.

Full anonymized log below:

START RequestId: 5dc60e52-f773-11e7-a45b-17d92e2998bb Version: $LATEST
2018-01-12T08:34:22.073Z 5dc60e52-f773-11e7-a45b-17d92e2998bb Incoming Message:
{
    "Records": [
        {
            "EventSource": "aws:sns",
            "EventVersion": "1.0",
            "EventSubscriptionArn": "arn:aws:sns:eu-west-1:123456789012:test-project-comp-application:22222222-e26c-4414-844f-11111111111",
            "Sns": {
                "Type": "Notification",
                "MessageId": "dddddd-a216-59d2-bbbb-123123123123",
                "TopicArn": "arn:aws:sns:eu-west-1:123456789012:test-project-comp-application",
                "Subject": "ALARM: \"test-project-comp-my-alarm\" in EU (Ireland)",
                "Message": "{\"AlarmName\":\"test-project-comp-my-alarm\",\"AlarmDescription\":\"Application startups logged in test-project\",\"AWSAccountId\":\"123456789012\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 datapoint [2.0 (12/01/18 08:33:00)] was greater than or equal to the threshold (1.0).\",\"StateChangeTime\":\"2018-01-12T08:34:12.375+0000\",\"Region\":\"EU (Ireland)\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"MetricName\":\"comp-my-alarm\",\"Namespace\":\"test-project\",\"StatisticType\":\"Statistic\",\"Statistic\":\"SUM\",\"Unit\":\"None\",\"Dimensions\":[],\"Period\":60,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanOrEqualToThreshold\",\"Threshold\":1.0,\"TreatMissingData\":\"\",\"EvaluateLowSampleCountPercentile\":\"\"}}",
                "Timestamp": "2018-01-12T08:34:12.407Z",
                "SignatureVersion": "1",
                "Signature": "K1OJELJE6lTKYbnW+FoIYe/LYccZG0LYD9/99F0uIeCsRWKpibPtOjkTT0xm45nGy2znQdk5wAD0ru3OjCmWfmI+KinBrhkLp9j6NYaGuFxeQdtAAifyaZSCPNYNLc5Fmjzuu7qjF0PYuzxzGR0iu4NT1FwMzufY9+iWGg3ZWyN5IBf9cFiKncTbDCv4SiQkNoez1bHcqsiK5IZX2r5mI2RvEapiisWi42ChcFweqpRWhmjdM9dbLhCMvaeE/4Xkbf74A/VjifTv/3nH2gugqJor6e7KOJwWtOMl/h35jL2QCf0hDfFCh5tAY40+fgO8S28B5Xt/p2BfMQV8/iZs4A==",
                "SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-22222222222222222222222222222222.pem",
                "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:123456789012:test-project-comp-application:22222222-e26c-4414-844f-11111111111",
                "MessageAttributes": {}
            }
        }
    ]
}

2018-01-12T08:34:24.633Z 5dc60e52-f773-11e7-a45b-17d92e2998bb Error rendering chart: TypeError: fromTime.getTime is not a function
2018-01-12T08:34:24.634Z 5dc60e52-f773-11e7-a45b-17d92e2998bb Sending Message to Slack:
{
    "attachments": [
        {
            "fallback": "test-project-comp-my-alarm state is now ALARM:\nThreshold Crossed: 1 datapoint [2.0 (12/01/18 08:33:00)] was greater than or equal to the threshold (1.0).",
            "color": "danger",
            "author_name": "Amazon CloudWatch Alarm",
            "title": "test-project-comp-my-alarm",
            "text": "Threshold Crossed: 1 datapoint [2.0 (12/01/18 08:33:00)] was greater than or equal to the threshold (1.0).",
            "fields": [
                {
                    "title": "Acount ID",
                    "value": "123456789012",
                    "short": true
                },
                {
                    "title": "Region",
                    "value": "EU (Ireland)",
                    "short": true
                },
                {
                    "title": "Old State",
                    "value": "INSUFFICIENT_DATA",
                    "short": true
                },
                {
                    "title": "New State",
                    "value": "ALARM",
                    "short": true
                }
            ],
            "ts": 1515746052
        }
    ]
}

2018-01-12T08:34:24.634Z 5dc60e52-f773-11e7-a45b-17d92e2998bb Posting to Slack...
2018-01-12T08:34:24.948Z 5dc60e52-f773-11e7-a45b-17d92e2998bb Message posted successfully.

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.