Skip to content
 
 

Repository files navigation

PagerDuty CLI

Build Status

A CLI for interacting with the PagerDuty API.

Installation

This tool assumes that you are a part of an account using Advanced Permissions.

  1. Acquire a PagerDuty developer API token.
  2. Create a configuration file at $HOME/.pagerduty.yml. The file should have the following information:
---
api-token: <your token>
user-email: <your PagerDuty user email>
  1. Download the latest binary release and place the binary somewhere in your $PATH.

  2. You should be able to run pagerduty-cli to see the available commands.

  3. You may wish to create an alias for the CLI as it's full name is admittedly verbose. You can add alias pd="pagerduty-cli" to your shell's profile if you so choose.

The user-email value is required for incident write operations in the TUI because PagerDuty uses it as the From header. Protect the configuration file with chmod 600 ~/.pagerduty.yml. You can alternatively set PAGERDUTY_API_TOKEN and PAGERDUTY_USER_EMAIL in the environment.

Upgrading

Upgrading is still a work in progress, so in the meantime, repeat step 3 from above with the latest binary. Eventually I would like this tool to upgrade itself, but I haven't yet gotten that far.

Usage

This tool, thanks to the awesome Cobra package strives to be self-service and self-documenting. You can run pagerduty-cli help with no additional commands to see a list of available commands. You can see additional help for subcommands by running pagerduty-cli help <subcommand>.

Incident console

Run pagerduty-cli tui to open a full-screen terminal console for the newest 100 incidents. The console supports filtering and refreshing incidents, viewing details and notes, acknowledging and resolving, adding notes and status updates, reassigning, escalating, snoozing, changing urgency, and opening an incident in the PagerDuty web UI.

The primary keyboard shortcuts are:

Key Action
j / k, arrows Move through incidents or scroll the focused view
Enter / Esc Focus incident details / return to the incident list
r Refresh
1 Open incidents (triggered and acknowledged)
2 / 3 / 4 / 5 Triggered / acknowledged / resolved / all incidents
a / x Acknowledge / resolve
n / p Add a note / send a status update
g / e Reassign / escalate
s / u Snooze / toggle urgency
o Open in the PagerDuty web UI
? / q Show help / quit

Without user-email (or PAGERDUTY_USER_EMAIL), the console remains available for viewing incidents but disables write actions.

Development

  1. Checkout this repository.
  2. Run go build .
  3. Run ./pagerduty-cli

Releases

  1. Bump the version in version/version.go. Commit the change to main.

  2. Create a new git tag.

$ git tag -a v0.1.0 -m "First release"
$ git push origin v0.1.0
  1. Run make release.

About

A CLI for quick PagerDuty access

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages