Coder Social home page Coder Social logo

rawfish-dev / redalert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonog/redalert

0.0 2.0 0.0 143 KB

For monitoring a series of servers at specified intervals & triggering actions if there is downtime (e.g. send email, post webhook).

CSS 2.21% HTML 2.21% Go 95.58%

redalert's Introduction

Redalert

For monitoring a series of servers at specified intervals & triggering alerts if there is downtime. Currently supports:

  • sending email (via gmail)
  • sending SMS (via Twilio)
  • posting a message to Slack
  • messaging on stderr

Features:

Alert options: ["stderr", "gmail", "slack", "twilio"] Provides ping status & latency info to stdout. Has a linear back-off after failed pings (see notes below). Provides a web status UI (visit localhost:8888/, configure port via env RA_PORT) Provides an alert when a failing server has recovered (i.e. a successful ping, following a failing ping).

Getting started:

Configure servers to monitor & alert settings via config.json:

{  
   "servers":[  
      {  
         "name":"Server 1",
         "address":"http://server1.com/healthcheck",
         "interval":10,
         "alerts":["stderr"]
      },
      {  
         "name":"Server 2",
         "address":"http://server2.com/healthcheck",
         "interval":10,
         "alerts":["stderr", "gmail", "slack", "twilio"]
      },
      {  
         "name":"Server 3",
         "address":"http://server3.com/healthcheck",
         "interval":10,
         "alerts":["stderr"]
      }
   ],
   "gmail": {
      "user": "",
      "pass": "",
      "notification_addresses": []
   },
   "slack": {
      "webhook_url": "",
      "channel": "#general",
      "username": "redalert",
      "icon_emoji": ":rocket:"
   },
   "twilio": {
      "account_sid": "",
      "auth_token": "",
      "twilio_number": "",
      "notification_numbers": []
   }

}

Build and run (capture stderr).

go build

./redalert 2> errors.log

Linear back-off after failure

The pinging interval will be adjusted to X * pinging interval where X is the number of times the pinger has failed. E.g. after 1 failure, the pinging interval will not be changed, but a server (with pinging interval of 10s) which has failed ping once will only be pinged after 20s, then 30s, 40s etc. When a failing server is successfully pinged, the pinging frequency returns to the originally configured value.

Note for Gmail:

If there are errors sending email via gmail - enable Access for less secure apps under Account permissions @ https://www.google.com/settings/u/2/security

Credits:

Rocket emoji via https://github.com/twitter/twemoji

TODO

  • Store latency information
  • Change server config on the fly
  • Alternative backoff configurations (e.g. no backoff / exponential backoff after X attempts)
  • Improved handling/recovering from any errors detected in redalert

redalert's People

Contributors

jonog avatar

Watchers

James Cloos avatar  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.