The PagerTree CLI is a powerful command-line tool for managing incidents, alerts, and on-call schedules in PagerTree, a modern incident management platform. Designed for sysadmins, DevOps engineers, and IT teams, it lets you interact with PagerTree’s API directly from your terminal, streamlining workflows and automating tasks.
- Create, view, and manage alerts, teams, broadcasts, and users.
- Filter and search resources with flexible options.
- View results in clean, table-formatted output.
- Configure via environment variables or a simple config file.
- Cross-platform support for macOS, Linux, and Windows.
- A PagerTree account and API key (get one from the PagerTree User Settings Page).
- Python 3.8+ (optional, only if not using pre-built binaries).
- Visit the releases page.
- Download the binary for your operating system (e.g.,
pagertree
,pagertree.exe
). - Make the binary executable (Linux/macOS):
chmod +x pagertree
- Move the binary to a directory in your PATH (e.g.,
/usr/local/bin
):mv pagertree /usr/local/bin/
- Verify installation:
pagertree --help
- Clone the repository:
git clone https://github.com/PagerTree/pager_tree-cli.git cd pager_tree-cli
- Set up a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
- Run the CLI:
python pagertree.py --help
To use the PagerTree CLI, you need to configure your PagerTree API key.
Set the API key as an environment variable:
export PAGERTREE_API_KEY=your_api_key_here
Add it to your shell profile (e.g., ~/.bashrc
, ~/.zshrc
) for persistence.
Create a .env
file in the current working directory or specify a custom path:
PAGERTREE_API_KEY = your_api_key_here
Specify the config file when running commands:
pagertree --config ../other/path/.env alerts list
Run pagertree --help
to see all available commands and options.
Command | Description |
---|---|
pagertree alerts list |
List all alerts. |
pagertree alerts list --status "open" |
List open alerts. |
pagertree alerts create --title "Out of Memory" --team-id "01JT13C98M186XA3QTRFC250MT" |
Create a new alert. |
pagertree alerts create --title "Out of Memory" --alias "oom" --team-id "01JT13C98M186XA3QTRFC250MT" |
Create a new alert with an alias. |
pagertree alerts show "01JT13CYDAMAJDM0G8HR1X8BMY" |
Show details of an alert. |
pagertree alerts acknowledge "01JT13CYDAMAJDM0G8HR1X8BMY" |
Acknowledge an alert. |
pagertree alerts resolve "01JT13CYDAMAJDM0G8HR1X8BMY" |
Resolve an alert. |
pagertree teams list |
List all teams. |
pagertree teams current-oncall "01JT13C98M186XA3QTRFC250MT" |
List current on-call users for a team. |
- Filter alerts with search:
pagertree alerts list --search "NEEDLE IN THE HAYSTACK"
- Paginate results:
pagertree alerts list --limit 10 --offset 0
- Use an alias for alerts:
pagertree alerts show --alias "oom"
For more commands, see the PagerTree CLI Documentation.
- Issues: Report bugs or request features on the GitHub Issues page.
- Documentation: Visit PagerTree CLI Documentation.
- Contact: Email support@pagertree.com for assistance.
This project is licensed under the MIT License. See the LICENSE file for details.