This repository has been archived by the owner on Mar 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2016 Sam Rudge, Songkick.com Ltd. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# PagerBot | ||
|
||
Update your Slack user groups based on your PagerDuty Schedules. | ||
|
||
At (Songkick)[https://www.songkick.com/], we use PagerDuty for managing our on call schedules. We also have a Slack user group pointing to the people currently on call, so anyone can ping them to alert them of any problems. But updating those user groups every week is both slightly boring, and easy to forget. So when you're working with two services that have APIs, why not automate it? | ||
|
||
PagerBot is a simple program to do this. Provided with your PagerDuty and Slack API credentials, and some simple configuration, it will update the usergroups automatically, as well as posting a message to channels you select informing everyone who's currently on the rota. | ||
|
||
# Installation | ||
|
||
Install the dependencies with `Glide` | ||
|
||
`glide install` | ||
|
||
Then build | ||
|
||
`go build` | ||
|
||
You should have a nice `pagerbot` binary ready to go. You can also download prebuild binaries from the (releases)[https://github.com/YoSmudge/pagerbot/releases] page. | ||
|
||
# Configuration | ||
|
||
A basic configuration file will look like | ||
|
||
```yaml | ||
api_keys: | ||
slack: "abcd123" | ||
pagerduty: | ||
org: "songkick" | ||
key: "qwerty567" | ||
|
||
groups: | ||
- name: firefighter | ||
schedules: | ||
- PAAAAAA | ||
- PBBBBBB | ||
update_message: | ||
message: ":fire_engine: Your firefighters are %s :fire_engine:" | ||
channels: | ||
- general | ||
- name: fielder | ||
schedules: | ||
- PCCCCCC | ||
update_message: | ||
message: "Your :baseball: TechOps @Fielder :baseball: this week is %s" | ||
channels: | ||
- team-engineering | ||
``` | ||
The configuration should be fairly straightforward, under API keys provide your Slack and Pagerduty keys. Under groups configure the Slack groups you'd like to update. Schedules is a list of PagerDuty schedule IDs, update_message is the message you'd like to post, and the channels you'd like to post them in. | ||
Once done, you can run PagerBot with `./pagerbot --config /path/to/config.yml` | ||
|
||
It's recommended to run PagerBot under Upstart or some other process manager. | ||
|
||
N.B. PagerBot matches PagerDuty users to Slack users by their email addresses, so your users must have the same email address in Slack as in PagerDuty. PagerBot will log warnings for any users it finds in PagerDuty but not in Slack. |