pagerdutyduty - generating PagerDuty schedules
A helpful hack using the PagerDuty API to make a responsive support schedule.
Scheduling on-call schedules has always been a bit of a pain, especially given the way we rotate shifts. PagerDuty’s interface really only satisfies one type of on-call schedule: scheduling people manually for multi-day or week-long blocks of 24/7 coverage.
At Olark, we prefer to have our on-call schedule rotate through people much more rapidly, in several hour blocks. This enables us to spread the obligation out a bit more fairly, and have the whole team as backup — plus it enables us to give every team member the guarantee that they’ll be free at least 6 hours every night.
The only real downside to this approach is that creating the schedule involves quite a bit of manual planning to put together. Not to mention, if you hire a new team member (something we like to do ) your whole schedule is invalid and needs to be recalculated and recreated.
Unfortunately in PagerDuty, there’s no way to temporarily remove someone from the on-call schedule (non- destructively). So if someone goes on vacation for two weeks — same thing, the whole schedule is invalid, as long as they’re scheduled, but not available.
To scratch this itch, we built pagerdutyduty , a tool that reads in a YAML file specifying your team members, their on/off hours, and the layers of your on-call schedule you’d like to fill.
Via the PagerDuty API, pagerdutyduty will create the perfect on-call schedule given your criteria. For example, let’s say you want your ops team on call 24/7 in rotating four hour blocks. Just create an on-call layer in YAML like so:
layers:
\- name: ops1
source: ops
respect_offhours: False
block_size: 4
And you want the whole engineering team as backup 24/7 (but giving people at least 6 hours off each night, according to time zone) in rotating one hour blocks:
layers:
\- name: everyone1
source: engineering
block_size: 4
But make sure not to schedule Julie, since she’s on vacation:
users:
\- id: P8EI9BL
offhours: [EST]
tags: [engineering]
vacation: True
`
Run pagerdutyduty with your PagerDuty API access key, and voilà, you’ve got a schedule that matches your criteria. Check out the Github page for the project
, or pip install pagerdutyduty. Right now the project satisfies our narrow use-case, but could possibly be a great place to start building something to satisfy yours!