Giter Club home page Giter Club logo

onsdigital.cloud-status-alerter's Introduction

Cloud Status Alerter

This repository contains a Ruby script that consumes the various service/vender status feeds and posts corresponding alerts to a specified Slack channel as events occur. A Google Cloud Firestore database is used to track a little state to ensure duplicate updates aren't posted.

Installation

  • Ensure that Ruby is installed
  • Install Bundler using gem install bundler
  • Install the RubyGems this script depends on using bundle install

Running

Environment Variables

The environment variables below are required:

FIRESTORE_PROJECT           # Name of the GCP project containing the Firestore project
SLACK_WEBHOOK               # Used for accessing the Slack Incoming Webhooks API
STATUS_ALERTS_SLACK_CHANNEL # Name of the Slack channel to post alerts to

The environment variable below is optional:

FIRESTORE_CREDENTIALS       # Path to the GCP service account JSON key (used when running locally)

Run the script using bundle exec ./cloud_status_alerter.rb.

Providers

Updates from a status feed source are implemented by providers, which are simply classes within the providers directory that conform to these rules:

  • Provider classes must inherit from the Provider base class
  • Provider class names must have an initial capital and then be all lower-case e.g. Github
  • The provider class's initialize method must set the @icon and @name for use within the Slack message (the icon should be the name of a Slack emoji minus the surrounding colons)
  • The provider class must implement a latest_update method that returns a populated StatusFeedUpdate struct. This struct contains the following fields:
Field Purpose
id Unique ID for the update. Not displayed, used as a document key in Firestore
timestamp Timestamp of the update
metadata Optional additional information about the update e.g. the name of the service affected
text Status update text
uri URI for viewing this individual status update online

Copyright

Copyright (C) 2019โ€“2020 Crown Copyright (Office for National Statistics)

onsdigital.cloud-status-alerter's People

Contributors

johntopleyons avatar dependabot[bot] 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.