# pagerduty-overlap-checker

> PagerDuty Overlap Duties Checker

Latest version **2.3.4** (published 2020-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install pagerduty-overlap-checker
pnpm add pagerduty-overlap-checker
yarn add pagerduty-overlap-checker
bun add pagerduty-overlap-checker
```

Provides the command `pdoverrides`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.4 |
| Published | 2020-11-24 |
| First published | 2016-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.12.0 |
| Dependencies | 12 |
| Unpacked size | 34.2 KB |
| Known vulnerabilities | 0 (+3 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Apiary Inc |
| Maintainers | abtris, apiary-sre |
| Keywords | pagerduty, checker, check |

## Links

- npm: https://www.npmjs.com/package/pagerduty-overlap-checker
- Repository: https://github.com/apiaryio/pagerduty-overlap-checker
- Homepage: https://github.com/apiaryio/pagerduty-overlap-checker#readme
- Issues: https://github.com/apiaryio/pagerduty-overlap-checker/issues
- npm.io page: https://npm.io/package/pagerduty-overlap-checker

## Dependencies (12)

- [ajv](https://npm.io/package/ajv.md) ^6.8.1
- [async](https://npm.io/package/async.md) 2.6.1
- [debug](https://npm.io/package/debug.md) >=4.1.1
- [nconf](https://npm.io/package/nconf.md) 0.10.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [request](https://npm.io/package/request.md) 2.88.0
- [commander](https://npm.io/package/commander.md) 2.19.0
- [node-slackr](https://npm.io/package/node-slackr.md) 1.0.1
- [moment-range](https://npm.io/package/moment-range.md) ^4.0.1
- [@slack/client](https://npm.io/package/@slack/client.md) ^4.9.0
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.23

## Recent versions

- 2.3.4 (latest) — 2020-11-24
- 2.3.3 — 2020-01-31
- 2.3.2 — 2019-02-25
- 2.3.1 — 2019-02-25
- 2.3.0 — 2019-02-20
- 2.2.0 — 2019-02-20
- 2.1.7 — 2018-10-18
- 2.1.6 — 2018-04-29
- 2.1.5 — 2018-04-28
- 2.1.4 — 2018-04-25
- 2.1.3 — 2017-10-30
- 2.1.2 — 2017-10-04
- 2.1.1 — 2017-10-02
- 2.1.0 — 2017-10-02
- 2.0.0 — 2017-09-27
- … 12 more at https://npm.io/package/pagerduty-overlap-checker/versions

## README

[![Build Status](https://github.com/apiaryio/pagerduty-overlap-checker/workflows/pagerduty-overlap-checker/badge.svg)](https://github.com/apiaryio/pagerduty-overlap-checker/actions?query=workflow%3A%22pagerduty-overlap-checker%22)
[![Coverage Status](https://coveralls.io/repos/github/apiaryio/pagerduty-overlap-checker/badge.svg?branch=master)](https://coveralls.io/github/apiaryio/pagerduty-overlap-checker?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

# NodeJS supported versions

- 10.x (LTS)
- 12.x (LTS)
- 14.x (LTS)

# Pager Duty Overlap Checker

## Usage

1. Create config file `config.json`

- `PAGERDUTY_READ_ONLY_TOKEN` is used for reading schedules and checking the overlaps.
- `SCHEDULES` array can contain one or more `SCHEDULE` items to check
- every `SCHEDULE` should have a `NOTIFICATIONS` section to create a PagerDuty incident or send a Slack message if overlap is found
- `SCHEDULE` can contain a `EXCLUSION_DAYS` key, which specifies days (3 letter abb.) in form of object with optional `start` and `end` time (`hh:mm` format **CET TIMEZONE**).If `start` or `end` is omitted, whole day is considered excluded.
Example below represents current weekend on-call setup.

Currently, we support Slack (`SLACK` with `SLACK_WEBHOOK_URL` and `CHANNEL`) or shorthanded `SLACK_WEBHOOK_URL` and
PagerDuty (`PAGERDUTY` with `PAGERDUTY_TOKEN`, `PAGERDUTY_SERVICE_ID` and `PAGERDUTY_FROM`) notifications. The
`PAGERDUTY_TOKEN` has to have full access.

For PagerDuty, an incident can either be directly assigned to the user with overlaps (default) or set to an escalation
policy (if specified by `PAGERDUTY_ESCALATION_POLICY_ID` in config).

All PagerDuty integrations are using [PagerDuty API v2](https://v2.developer.pagerduty.com/v2/page/api-reference#!/API_Reference/get_api_reference).
When generating an API token, select the v2 option.

```json
{
    "PAGERDUTY_API_URL": "https://acme.pagerduty.com/api/v1",
    "PAGERDUTY_READ_ONLY_TOKEN": "33333333333333333333",
    "WEEKS_TO_CHECK": 2,
    "SCHEDULES": [{
        "SCHEDULE": ["PWEVPB6", "PT57OLG"],
        "NOTIFICATIONS": {
            "SLACK": {
              "SLACK_WEBHOOK_URL": "http://acme.slack.com/11111",
              "CHANNEL": "#channel-name"
            }
        }
    }, {
        "SCHEDULE": ["PWEVPB6", "PT57OLA"],
        "NOTIFICATIONS": {
          "PAGERDUTY": {
            "PAGERDUTY_TOKEN": "22222222222222222222",
            "PAGERDUTY_SERVICE_ID": "PFARE53",
            "PAGERDUTY_FROM": "test@test.com"
          },
          "SLACK_WEBHOOK_URL": "http://acme.slack.com/11111"
        },
        "EXCLUSION_DAYS": {"Fri": {"start": "18:00", "end": "23:59"}, "Sat": {}, "Sun": {"start": "00:00", "end": "18:00"}}
    }]
}
```

2. Run command and check:

```sh
$ ./bin/pdoverrides check --config config.json

Config schedule IDs passed.
OK
```

## Debug problems

For debugging you can use `debug` package included in the library:

`DEBUG=pagerduty-overrides* ./bin/pdoverrides check -c config.json`

Alternatively, you can include the `DEBUG` variable in the `config.json` file (esp. for debugging on AWS Lambda).

---
_Source: https://npm.io/package/pagerduty-overlap-checker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
