Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
/ pd Public archive

/pe.de/ - command line tool to query PagerDuty for the current on-calls

License

Notifications You must be signed in to change notification settings

elephant-graveyard/pd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pd

License Go Report Card Tests Codecov Go Reference Release

/pe.de/ - command line tool to query PagerDuty for the current on-calls

Setup

Install the pd binary via brew on macOS, or find the respective binary of the latest release.

brew install homeport/tap/pd

Create a .pd.yml file in your home directory that contains a PagerDuty authentication token. Go to your PagerDuty profile settings and under "User Settings" you will find a Create API User Token button.

pd-yaml-example

Next, you'll need to configure different shifts in the .pd.yml file. This step can be skipped if you don't need to use the current-shift command. The file should now look somewhat like this:

authtoken: bm9ub25vbm9ub25vbm8K
own-shift: Team Bar
shift-times:
    - end: 08:00
      name: Team Foo
      start: 00:00
    - end: 16:00
      name: Team Bar
      start: 08:00
    - end: 00:00
      name: Team Foobar
      start: 16:00

Commands

pd on-call

Displays all current on calls.

pd current-shift

Displays which shift is currently on-call (if shifts are configured in the .pd.yml file).

pd set-own-shift [shift-name]

Updates own-shift in .pd.yml file.

pd list-alerts

Lists all alerts that happened in a specified timeframe.

Flag Description
--id <user-ID> list all alerts for the user
--from <time> lists all alerts after the specified time
--to <time> lists all alerts until the specified time

user-ID is a 7 character long ID found on PagerDuty.

time has to be provided using the format RFC3339 (2006-01-02T15:04:05Z07:00)

If --from and --to are both not used, all non-resolved issues for the user are displayed.