(Translated by https://www.hiragana.jp/)
GitHub - jsdf/they-live: serverless server monitoring with near-zero running costs
Skip to content
/ they-live Public

serverless server monitoring with near-zero running costs

Notifications You must be signed in to change notification settings

jsdf/they-live

Repository files navigation

THEY LIVE

THEY LIVE is a simple endpoint health monitor with email notifications, which runs on AWS free tier services (Lambda, SimpleDB, SES), so it costs next-to-nothing to run.

instructions

first, clone this repo

copy config.default.js to config.js and customise it:

module.exports = {
  region: 'us-east-1', // aws region for simpledb & ses
  websites: {
    // groups of websites can be defined to ping at different intervals.
    // the keys of this object must match the 'group' parameter passed to the
    // cron event in serverless.yml (see below)
    oncePer10Mins: [
      {
        name: 'example-site', // unique site name
        url: 'http://example.com/health', // endpoint to request for healthcheck
      },
    ],
    // another group which pings at a different interval
    oncePerDay: [
      {
        name: 'other-site',
        url: 'http://example.com/health2',
        attempts: 3, // will retry this many times
        interval: 15, // seconds between retries
      },
    ],
  },
  notifyTo: ['someguy@example.com'], // email to notify of health changes
  notifyFrom: 'someguy@example.com', // email to send notification from
};

in serverless.yml (note the 'group' param)

functions:
  cron:
    handler: handler.cron
    events:
      - schedule:
        rate: rate(10 minutes)
        input:
          group: oncePer10Mins
      - schedule:
        rate: rate(1 day)
        input:
          group: oncePerDay

run yarn install to install dependencies

run aws configure if you haven't already, to set up aws credentials

run node migrate.js to create the AWS SimpleDB 'domain' (basically a database)

verify your email address in AWS SES console

deploy using serverless framework

yarn global add serverless # install globally
serverless deploy

watch for a successful invocation in lambda console. scroll down on this page to see the logs in cloudwatch

you can also test that it runs locally

yarn local --data='{"group": "oncePerDay"}'

About

serverless server monitoring with near-zero running costs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published