GithubHelp home page GithubHelp logo

uk-gov-mirror / alphagov.pay-pagerduty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alphagov/pay-pagerduty

0.0 0.0 0.0 19 KB

For configuring pagerduty

License: MIT License

Ruby 100.00%

alphagov.pay-pagerduty's Introduction

Pager duty schedule

Configure the expected schedule using CSV files in the data/ subdirectory.

There are three files you need:

  1. data/schedules.csv - defines the Name, ID and Type of each schedule (Type is either in_hours or out_of_hours)
  2. data/users.csv - defines the Name and ID of users
  3. data/rota.csv - defines the rota, using the following columns:
    1. 'Week Commencing' - in format YYYY-MM-DD
    2. '<Schedule name 1>' - heading corresponds to the name of the schedule, value is the name of the user
    3. '<Schedule name 2>' - etc...

For examples see spec/fixtures/.

Prerequisites

This is opinionated

It's designed to work specifically with our support rota which works as follows:

  • in hours support is 09:30 - 17:30 on weekdays
  • on call is 17:30-09:30 on weekdays and 17:30 Friday - 09:30 Monday on weekends
  • a rotation starts on a Wednesday at 09:30

We have rudimentary support for bank holidays, but it doesn't quite work.

Usage

Use bundler to install required packages:

$ bundle install

run with --help for usage

$ bundle exec bin/schedule --help

  checks pager duty schedule
  requires PAGER_DUTY_API_KEY env var

    -y, --apply  apply overrides
    -n, --dry-run  go through the motions of applying overrides, but don't actually do it
    -u, --get-users  fetch user list
    -s, --get-schedules  fetch schedules
    --help

The first step is to set up the user and schedule data if you haven't already:

$ bundle exec ./bin/schedule -u -s

This fetches the list of users and schedules from pager duty and stores them in data/. You'll need to add the Type column to data/schedules.csv

Now create data/rota.csv and fill it in correctly.

Week Commencing,Primary - in hours,Secondary - in hours
2017-06-28,Jane,Ella
2017-07-05,Simone,Anna

The data format needs to be YYYY-MM-DD.

Now you can do a dry run:

$ bundle exec ./bin/schedule -n

This works through each schedule listed in schedules.csv and for each one:

  • fetches the schedule from pager duty covering the date range of the entries in rota.csv
  • checks that the actual schedule matches rota.csv
  • if it doesn't, it will attempt to create overrides to correct it (these are not applied in dry-run mode)

When you're happy with the proposed changes go ahead and apply them:

$ bundle exec ./bin/schedule -y

alphagov.pay-pagerduty's People

Contributors

heathd 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.