GithubHelp home page GithubHelp logo

hb-api's Introduction

hb-api

Build Status

AWS Serverless API to receive heartbeats and send notifications when computers disappear.

Table of Contents

Introduction

The Problem

There is no easy way to know when a computer dies. Specially in large networks where computers are geographically distributed.
Think in every cash register of every fast food restaurant in the entire world. Thousands of computers that may disappear at any time because of power outages or connectivity issues.
Directly testing each computer is not always feasible, most of the time restaurant chains control the computer but not the network or the firewall rules. Think about all the work required to setup thousands of port forwarding rules throughout the Globe. And the additional security risks of doing so.

The solution

Rather than actively monitoring each computer. We make every computer send a message whenever it can. A lack of messages from a computer for a sustained period of time indicates a problem.
This pattern is known as Heartbeat and is widely used through the industry.

Getting Started

Prerequisites

1- Make sure to have the api deployed following the steps from the Deployment document
2- Create at least one API Key following the steps from the API Key Management document
3- Create at least one subscription to receive notifications when hosts disappear. Follow the steps from the Subscription Management document

Usage

Configure a cronjob to post heartbeats following the steps from the Usage document.

*/5 * * * * curl -i -H "x-api-key: ${HB_API_KEY}" -d '{"hostId": "'${HOSTNAME}'"}' -X POST https://api.yourdomain.com/v1/hearbeat | logger -p local0.notice

Design considerations

The application runs simultaneously on two different AWS regions.
Load balancing and region failover is managed by Route53 healthchecks.
Data is globally replicated with DynamoDB Global Tables.
Notifications are sent using SNS Topics. And we did our best to ensure they are delivered exactly once.
Costs are kept at a minimum and increase only with increased usage.

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.