Git Product home page Git Product logo

lambda-watchtower's Introduction

lambda-watchtower

lambda-watchtower is a script for monitoring one or several HTTP(S) endpoints with AWS Lambda. Logs are stored as AWS CloudWatch metrics.

Usage

lambda-watchtower supports the following event parameters:

{
  "targets": [
    {
      "url": "https://example.org",
      "name": "example.org", //Optional, defaults to url; Display name of the target
    },
	{
	  "name": "Mailserver SMTP port check",
	  "type": "port",
	  "hostname": "mailserver.example.org",
	  "port": 25
	}
  ],
  "namespace": "Watchtower", //Optional, defaults to "Watchtower"; CloudWatch namespace
  "timings": ["readable", "total"], Optional, defaults to ["readable", "total"]; Determine which timings are logged.
  "timeout": 2000 //Optional, defaults to 2000: Time in ms before requests are aborted
}

Supported Timings

The following timings are supported and can be logged by lambda-watchtower:

  • lookup: Time between beginning of request and successful DNS lookup
  • connect: Time between DNS lookup and TCP connect
  • secureConnect: Time between TCP connect and completion of HTTPS handshake
  • readable: Time between successfully establishing the connection (and HTTPS handshake) and first byte received
  • close: Time between first byte and the end of the request
  • total: Total time from the beginning to the end of the request

Setup

There is a detailed step-by-step guide explaining how to set up lambda-watchtower. Read the step-by-step instructions.

If you’re already familiar with AWS IAM and Lambda, here is the short version for you:

  1. Create a new IAM Role for Lambda with PutMetricData permissions for CloudWatch
  2. Create a new Lambda Function with the contents of index.js assign the IAM role created above to this function.
  3. Create a new CloudWatch Event Rule of type schedule.
  4. Select how often you would like to check your endpoints.
  5. Add the new Lambda function as the target.
  6. Configure the input of the target and select "Constant (JSON text)".
  7. Put the configuration JSON (see Usage) in the input field.
  8. Save everything and give it a few minutes. New CloudWatch metrics can take a little while to show up.

Contributing

Pull requests and issues for additional features are welcome.

License

lambda-watchtower is licensed under the terms of the MIT license. For further information, please refer to the LICENSE file.

lambda-watchtower's People

Contributors

wmnnd avatar jwestbrook 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.