Docs
WebsiteLoginFree Trial
  • Getting Started
    • OnCall Users
    • Team Admins
    • Account Admins
  • Architecture Guide
  • Common UI Design Patterns
  • Alerts
  • Teams
  • Schedules
  • Escalation Policies
  • Integrations
  • Broadcasts
  • Users
  • Notifications
  • Reports
  • Billing
  • Accounts
  • Stakeholders
  • Maintenance Windows
  • Routers
  • Notification Rules
  • Single Sign On (SSO)
  • Integration Guides
    • Introduction
    • 66uptime
    • Apex Ping
    • AppDynamics
    • Auvik
    • AWS CloudWatch
    • Azure Monitor
    • Cloudflare
    • Cronitor
    • Datadog
    • Dead Man's Snitch
    • Echoes HQ
    • ElastAlert
    • Email
    • Form
    • Freshdesk
    • Freshservice
    • Google Hangouts Chat
    • Grafana
    • Healthchecks.io
    • HetrixTools
    • Honeybadger
    • Hydrozen
    • Jira Server
    • JotForm
    • Kapacitor
    • LogicMonitor
    • Mattermost
      • Outgoing Webhook
      • Post to Channel
    • Meta Workplace
    • Microsoft Teams
    • New Relic
    • Outgoing Webhook
    • Pingdom
    • Prometheus
    • PRTG Network Monitor
    • Pulsetic
    • Sentry
    • ServerGuard24
    • Site24x7
    • Slack
      • Notifications
      • Outgoing Webhook
      • Post to Channel
    • SolarWinds
    • Stackdriver
    • StatusCake
    • Twilio
      • Incoming SMS
      • Live Call Routing
    • Typeform
    • Uptime
    • Uptime Kuma
    • UptimeRobot
    • Webhook
    • Zendesk
  • API
    • Introduction
    • Authentication
    • Errors
    • Pagination and Filters
    • Common Model Attributes
    • Account Users
    • Alerts
    • Broadcasts
    • Comments
    • Escalation Policies
    • Events
    • Integrations
    • Logs
    • Maintenance Windows
    • Notification Rules
    • Routers
    • Schedules
    • Teams
    • Users
  • Command Line Interface (CLI)
    • PagerTree CLI: Command Line Interface
Powered by GitBook
On this page
  • Introduction
  • Installation
  • Prerequisites
  • Installation Methods
  • Configuration
  • .env
  • Environment Variables
  • Configuration Options
  • Commands
  • Help System
  • Logging
  • Troubleshooting

Was this helpful?

  1. Command Line Interface (CLI)

PagerTree CLI: Command Line Interface

Explore PagerTree's Command Line Interface (CLI). Learn to manage alerts efficiently with our CLI. Perfect for DevOps teams seeking streamlined incident management.

PreviousUsers

Last updated 7 days ago

Was this helpful?

Introduction

The (pagertree or pagertree.exe ) is a command-line utility designed to interact with the PagerTree incident management platform. It enables users to create, acknowledge, and resolve alerts, as well as integrate PagerTree with other tools via shell scripts. The CLI communicates with , providing a flexible way to automate incident management tasks.

Installation

Prerequisites

Installation Methods

  • From Source:

    • Clone the repository and install manually:

      git clone https://github.com/PagerTree/pager_tree-cli.git
      cd pager_tree-cli
      python -m venv venv
      source venv/bin/activate
      pip install -r requirements.txt
      python pagertree.py --help

Configuration

The PagerTree CLI can use multiple methods for configuration:

.env

The CLI will look for a .env file in the current working directory. A .env file simply loads key value pairs into environment variables on application initialization.

.env
PAGERTREE_API_KEY=your_api_key_here

Alternatively, you can specify the .env file through the command flag.

pagertree -c ../some/other/path/.env alerts list

Environment Variables

You can run the CLI with the environment variables directly set.

Linux / MacOS
export PAGERTREE_API_KEY=your_api_key_here
pagertree alerts list

# Alternatively, use the environment variable just for a single command
PAGERTREE_API_KEY=your_api_key_here pagertree alerts list
Powershell
$env:PAGERTREE_API_KEY="your_api_key_here"
pagertree.exe alerts list

Configuration Options

Environment Variable
Description
Required

PAGERTREE_API_KEY

Yes

PAGERTREE_BASE_URL

The PagerTree API endpoint (default: https://api.pagertree.com/api/v4).

No

PAGERTREE_VERBOSE

Enable verbose output.

No

Commands

The PagerTree CLI offers a range of commands for interacting with PagerTree. Run pagertree --help to see the complete list of commands.

Common Commands

  • pagertree alerts list --status "open": List open alerts.

  • pagertree alerts create --title "Out of Memory" --alias "oom" --team-id "01JT13C98M186XA3QTRFC250MT: Create a new alert with an alias.

  • pagertree teams list: List all teams.

  • pagertree teams current-oncall "01JT13C98M186XA3QTRFC250MT": List current on-call users for a team.

Help System

The CLI includes a contextual help system. Use the --help flag to explore commands and options:

  • List all commands:

    pagertree --help
  • Get help for a specific command:

    pagertree <command> --help

Logging

Enable verbose output for debugging by adding the --verbose or -v flag:

pagertree --verbose alerts list 

Troubleshooting

  • Command Not Found: Ensure pagertree is installed and accessible in your PATH. Ensure you have typed the command correctly.

  • API Key Errors: Verify that your API key is supplied and correct.

  • Connection Issues: Check your internet connection or proxy settings (if applicable).

pagertree includes a built-in to guide users through available commands and options. It is ideal for integrating PagerTree with monitoring tools, automating workflows, or performing administrative tasks from the command line.

This documentation provides instructions for installing, configuring, and using the PagerTree CLI. For the latest updates and source code, visit the .

PagerTree Account: You need a valid PagerTree account and an API key. Create an API Key in your to obtain your API key.

Internet Access: The CLI requires an internet connection to communicate with PagerTree's API. If your environment uses a proxy, configure proxy settings as described in the .

Precompiled Binaries: Download precompiled distributions from the .

Python: The PagerTree CLI is built using Python. Ensure you have Python 3.8 or later installed. Download it from .

An .env

Your PagerTree API key, obtained from the .

For additional support, file an issue on the or contact PagerTree support at .

GitHub repository
PagerTree user settings page
GitHub Releases page
python.org
GitHub repository
[email protected]
help system
Configuration section
environment variable file
Environment variables
PagerTree user settings page
PagerTree CLI
PagerTree's RESTful Web API
Screenshot of pagertree.exe