monitor Command
The monitor command wraps a command with automatic start/success/fail pings.
# Using slug (requires authentication)pakyas monitor <slug> -- <command> [args...]
# Using check ID (no authentication required)pakyas monitor --public_id <uuid> -- <command> [args...]Examples
Section titled “Examples”# Basic usage with slugpakyas monitor backup-db -- ./backup.sh
# Using check ID (no API key required)pakyas monitor --public_id "$PAKYAS_PUBLIC_ID" -- ./backup.sh
# With argumentspakyas monitor db-sync -- pg_dump -h localhost mydb > backup.sql
# With environment variablespakyas monitor report-gen -- env VAR=value ./generate-report.shWhat It Does
Section titled “What It Does”- Sends
/startping to Pakyas - Runs the command
- Captures exit code and stderr
- Sends success (
/) or failure (/<exit_code>) ping - Includes truncated stderr in failure payload (max 10KB)
| Flag | Description |
|---|---|
--public_id <uuid> | Check public ID - skips authentication and slug resolution |
--no-external | Disable external monitors |
--migration-mode | Allow external success to override Pakyas failure |
--external-timeout-ms | Timeout for external monitor requests (default: 5000) |
Inline External Monitor Flags
Section titled “Inline External Monitor Flags”These flags let you specify external monitors directly on the command line without a config file:
| Flag | Description |
|---|---|
--healthchecks-id <uuid> | healthchecks.io check UUID |
--healthchecks-endpoint <url> | Custom healthchecks.io endpoint (default: https://hc-ping.com) |
--cronitor-key <key> | Cronitor monitor key |
--cronitor-api-key <key> | Cronitor API key (required with --cronitor-key) |
--cronitor-endpoint <url> | Custom Cronitor endpoint (default: https://cronitor.link) |
--webhook-url <url> | Webhook URL (can be specified multiple times) |
# With healthchecks.iopakyas monitor backup-db --healthchecks-id abc123 -- ./backup.sh
# With Cronitorpakyas monitor backup-db --cronitor-key my-monitor --cronitor-api-key xxx -- ./backup.sh
# With webhookpakyas monitor backup-db --webhook-url https://my-server.com/hook -- ./backup.sh
# Multiple external monitorspakyas monitor backup-db \ --healthchecks-id abc123 \ --webhook-url https://hook1.example.com \ --webhook-url https://hook2.example.com \ -- ./backup.shCLI monitors are merged additively with config file monitors, so you can define common monitors in your config and add one-off monitors via CLI.
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
PAKYAS_PUBLIC_ID | Check UUID for --public_id flag (no auth required) |
PAKYAS_HEALTHCHECKS_ID | healthchecks.io check UUID |
HEALTHCHECKS_ENDPOINT | Custom healthchecks.io endpoint |
PAKYAS_CRONITOR_KEY | Cronitor monitor key |
CRONITOR_API_KEY | Cronitor API key |
PAKYAS_WEBHOOK_URL | Webhook URL |
Exit Codes
Section titled “Exit Codes”The command exits with:
- The wrapped command’s exit code (if Pakyas ping succeeded)
- Exit code 3 if Pakyas ping failed (monitoring infrastructure failure)
See Also
Section titled “See Also”- External Monitors - Migration from other services
- ping Command - Manual ping sending