### Install the CLI globally Source: https://onlineornot.com/docs/how-to/cli/install Installs the package globally using npm. ```bash npm install -g onlineornot ``` -------------------------------- ### Update the CLI Source: https://onlineornot.com/docs/how-to/cli/install Updates the existing global installation or installs via Volta. ```bash npm update -g onlineornot ``` ```bash volta install onlineornot ``` -------------------------------- ### Run without installation Source: https://onlineornot.com/docs/how-to/cli/install Executes the CLI temporarily using npx without a permanent global installation. ```bash npx onlineornot ``` ```bash npx onlineornot@latest ``` -------------------------------- ### Authenticated output example Source: https://onlineornot.com/docs/how-to/cli/login The expected output when the CLI is successfully authenticated. ```text Getting User settings... 👋 You are logged in with an API Token. 🔓 Token Permissions: Scope (Access) - uptime_checks (edit) ``` -------------------------------- ### Unauthenticated output example Source: https://onlineornot.com/docs/how-to/cli/login The expected output when the CLI is not authenticated. ```text Getting User settings... You are not logged in. Rerun this command with ONLINEORNOT_API_TOKEN set as an environment variable. ``` -------------------------------- ### Check a login flow Source: https://onlineornot.com/docs/how-to/browser-checks/scripted-checks Example of automating a login process using Playwright locators and assertions. ```javascript import { test, expect } from '@playwright/test'; test.setTimeout(90000); test.use({ actionTimeout: 10000 }); test('can log in', async ({ page }) => { await page.goto('https://example.com/login'); await page.getByLabel('Email').fill('monitor@example.com'); await page.getByLabel('Password').fill('your-test-account-password'); await page.getByRole('button', { name: 'Log in' }).click(); await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible(); }); ``` -------------------------------- ### Heartbeat status transition flow Source: https://onlineornot.com/docs/explanation/heartbeats The typical lifecycle of a heartbeat status from initial setup through failure and recovery. ```text Pending -> Up -> Down -> Up ``` -------------------------------- ### Webhook Payload Examples Source: https://onlineornot.com/docs/how-to/alerts/webhooks JSON payload structures sent by OnlineOrNot for different uptime and heartbeat events. ```json { "event": "uptime.down", "trigger": "down", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` ```json { "event": "uptime.up", "trigger": "up", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` ```json { "event": "heartbeat.down", "trigger": "down", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` ```json { "event": "heartbeat.up", "trigger": "up", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` -------------------------------- ### Define a TCP payload Source: https://onlineornot.com/docs/how-to/uptime-monitoring/create-tcp-monitor Example of a PING command with escaped line endings for protocols requiring them. ```text PING\r\n ``` -------------------------------- ### Initiate CLI login Source: https://onlineornot.com/docs/how-to/cli/login Opens the Developer Portal to generate an API token. ```bash onlineornot login ``` -------------------------------- ### Open documentation Source: https://onlineornot.com/docs/reference/cli-commands Opens the official documentation in the default web browser. ```bash onlineornot docs ``` -------------------------------- ### List uptime checks Source: https://onlineornot.com/docs/reference/cli-commands Lists all configured uptime checks. ```bash onlineornot checks list [OPTIONS] ``` -------------------------------- ### Open billing settings Source: https://onlineornot.com/docs/reference/cli-commands Opens the billing settings page in the default web browser. ```bash onlineornot billing ``` -------------------------------- ### Monitor status change sequence Source: https://onlineornot.com/docs/explanation/webhooks Illustrates the state transition logic that triggers uptime-related webhook events. ```text Up -> Down: send uptime.down Down -> Up: send uptime.up ``` -------------------------------- ### onlineornot login Source: https://onlineornot.com/docs/reference/cli-commands Opens the Developer Portal to facilitate API token creation. ```APIDOC ## onlineornot login ### Description Open the Developer Portal to create an API token. ### Usage `onlineornot login` ``` -------------------------------- ### Create an uptime check Source: https://onlineornot.com/docs/reference/cli-commands Creates a new uptime check for a specified URL. ```bash onlineornot checks create [OPTIONS] ``` -------------------------------- ### onlineornot docs Source: https://onlineornot.com/docs/reference/cli-commands Opens the official documentation in your default web browser. ```APIDOC ## onlineornot docs ### Description Opens the documentation in your browser. ### Usage `onlineornot docs` ``` -------------------------------- ### Configure request body Source: https://onlineornot.com/docs/reference/request-settings The request body is sent as entered; ensure JSON is stringified before input. ```json {"key": "value"} ``` -------------------------------- ### Create a basic homepage browser check Source: https://onlineornot.com/docs/how-to/browser-checks/scripted-checks A standard Playwright script for verifying page accessibility and status codes. ```javascript import { test, expect } from '@playwright/test'; test.setTimeout(90000); test.use({ actionTimeout: 10000 }); test('check homepage', async ({ page }) => { const response = await page.goto('https://example.com'); await expect(page.getByRole('heading', { name: 'Example Domain' })).toBeVisible(); expect(response?.status(), 'should respond with correct status code').toBeLessThan(400); }); ``` -------------------------------- ### Set API token environment variable Source: https://onlineornot.com/docs/how-to/cli/login Configures the CLI authentication token for the current session. ```bash export ONLINEORNOT_API_TOKEN=your-api-token-here ``` -------------------------------- ### Report a successful job execution Source: https://onlineornot.com/docs/explanation/heartbeats Use the shell command to ping the heartbeat URL only after the preceding command completes successfully. ```bash backup_db_to_r2 && curl https://oonchk.com/your-heartbeat-id ``` -------------------------------- ### Verify authentication status Source: https://onlineornot.com/docs/how-to/cli/login Checks the current login status and displays token permissions. ```bash onlineornot whoami ``` -------------------------------- ### OnlineOrNot User Agent String Source: https://onlineornot.com/docs/reference/user-agent The specific User Agent string used for all uptime monitoring requests. ```text OnlineOrNot.com_bot_1.0_(https://onlineornot.com) ``` -------------------------------- ### View an uptime check Source: https://onlineornot.com/docs/reference/cli-commands Displays details for a specific uptime check by its ID. ```bash onlineornot checks view [OPTIONS] ``` -------------------------------- ### onlineornot checks create Source: https://onlineornot.com/docs/reference/cli-commands Creates a new uptime check for a specified URL. ```APIDOC ## onlineornot checks create ### Description Create a new uptime check. ### Usage `onlineornot checks create [OPTIONS]` ### Arguments - **NAME** (string) - Required - Name of the check - **URL** (string) - Required - URL to monitor ### Options - **--json** (boolean) - Output as JSON ``` -------------------------------- ### onlineornot billing Source: https://onlineornot.com/docs/reference/cli-commands Opens the billing settings page in your browser. ```APIDOC ## onlineornot billing ### Description Open billing settings in your browser. ### Usage `onlineornot billing` ``` -------------------------------- ### onlineornot checks list Source: https://onlineornot.com/docs/reference/cli-commands Lists all uptime checks associated with the account. ```APIDOC ## onlineornot checks list ### Description List all uptime checks. ### Usage `onlineornot checks list [OPTIONS]` ### Options - **--json** (boolean) - Output as JSON ``` -------------------------------- ### Attach screenshots to failed runs Source: https://onlineornot.com/docs/how-to/browser-checks/scripted-checks Captures a screenshot during script execution to provide context in failure traces. ```javascript await page.screenshot({ path: 'dashboard.png' }); ``` -------------------------------- ### onlineornot whoami Source: https://onlineornot.com/docs/reference/cli-commands Displays information about the currently authenticated user. ```APIDOC ## onlineornot whoami ### Description Display current user information and verify authentication. ### Usage `onlineornot whoami` ``` -------------------------------- ### onlineornot checks view Source: https://onlineornot.com/docs/reference/cli-commands Displays details for a specific uptime check by ID. ```APIDOC ## onlineornot checks view ### Description View a specific uptime check. ### Usage `onlineornot checks view [OPTIONS]` ### Arguments - **ID** (string) - Required - Check ID ### Options - **--json** (boolean) - Output as JSON ``` -------------------------------- ### Uptime Check Event Payloads Source: https://onlineornot.com/docs/reference/webhook-payload JSON structure for uptime check status changes. ```json { "event": "uptime.down", "trigger": "down", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` ```json { "event": "uptime.up", "trigger": "up", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` -------------------------------- ### Troubleshoot validation errors Source: https://onlineornot.com/docs/how-to/browser-checks/scripted-checks Required import and test block structure for Playwright scripts. ```javascript import { test, expect } from '@playwright/test'; ``` ```javascript test('check page', async ({ page }) => { await page.goto('https://example.com'); }); ``` -------------------------------- ### Log out of the CLI Source: https://onlineornot.com/docs/how-to/cli/login Removes the API token from the current session environment. ```bash unset ONLINEORNOT_API_TOKEN ``` -------------------------------- ### Heartbeat Event Payloads Source: https://onlineornot.com/docs/reference/webhook-payload JSON structure for heartbeat monitoring events. ```json { "event": "heartbeat.down", "trigger": "down", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` ```json { "event": "heartbeat.up", "trigger": "up", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` -------------------------------- ### Webhook Payload Format Source: https://onlineornot.com/docs/how-to/alerts/webhooks The structure of the JSON payload sent by OnlineOrNot to your configured webhook URL. ```APIDOC ## Webhook Payload ### Description OnlineOrNot sends a POST request with a JSON payload to your configured URL when a monitored event occurs. ### Payload Examples #### Uptime Check Down ```json { "event": "uptime.down", "trigger": "down", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` #### Uptime Check Up ```json { "event": "uptime.up", "trigger": "up", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } ``` #### Heartbeat Down ```json { "event": "heartbeat.down", "trigger": "down", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` #### Heartbeat Up ```json { "event": "heartbeat.up", "trigger": "up", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } ``` ``` -------------------------------- ### Add heartbeat to crontab Source: https://onlineornot.com/docs/how-to/uptime-monitoring/cron-jobs Append a curl request to your cron job command to report success to the heartbeat URL. ```bash # my crontab 30 18 * * * backup_db_to_r2 && curl https://oonchk.com/xxxxxxxxx ``` -------------------------------- ### Webhook Event Payloads Source: https://onlineornot.com/docs/reference/webhook-payload The following event types are sent via POST requests to your webhook URL. These payloads provide details about the state changes in your monitored resources. ```APIDOC ## Webhook Event Payloads ### Uptime Check Events - **uptime.down**: Fires when an uptime check fails. - **uptime.up**: Fires when an uptime check recovers. ### Heartbeat Events - **heartbeat.down**: Fires when a heartbeat stops after missing its expected ping. - **heartbeat.up**: Fires when a heartbeat resumes. ### Status Page Incident Events - **status_page.incident.started**: Fires when a new incident is created. - **status_page.incident.updated**: Fires when an incident is updated. - **status_page.incident.resolved**: Fires when an incident is resolved. ### Payload Examples #### Uptime Event Example { "event": "uptime.down", "trigger": "down", "name": "Some Page", "url": "https://example.com/health", "alert_priority": "HIGH" } #### Heartbeat Event Example { "event": "heartbeat.down", "trigger": "down", "id": "aB3dE5gH7jK9mN2pQ4rS6tV8", "name": "Nightly backup job", "url": "https://onlineornot.com/app/heartbeats/aB3dE5gH7jK9mN2pQ4rS6tV8" } #### Status Page Incident Example { "api_version": "2025-01-27", "type": "status_page.incident.started", "data": { "object": { "object": "status_page", "id": "1234567890", "name": "My Status Page", "incident": { "id": "1234567890", "title": "API degraded performance", "impact": "DEGRADED_PERFORMANCE" } } } } ``` -------------------------------- ### Status Page Incident Event Payloads Source: https://onlineornot.com/docs/reference/webhook-payload JSON structure for status page incident lifecycle events. ```json { "api_version": "2025-01-27", "type": "status_page.incident.started", "data": { "object": { "object": "status_page", "id": "1234567890", "name": "My Status Page", "subdomain": "my-status-page", "custom_domain": "https://status.example.com", "incident": { "id": "1234567890", "title": "API degraded performance", "impact": "DEGRADED_PERFORMANCE", "started_at": "2025-05-07T12:34:56Z", "url": "https://status.example.com/incidents/1234567890", "components": [ { "id": "component-id", "name": "API", "status": "DEGRADED_PERFORMANCE" } ] } } } } ``` ```json { "api_version": "2025-01-27", "type": "status_page.incident.updated", "data": { "object": { "object": "status_page", "id": "1234567890", "name": "My Status Page", "subdomain": "my-status-page", "custom_domain": "https://status.example.com", "incident": { "id": "1234567890", "title": "API degraded performance", "impact": "DEGRADED_PERFORMANCE", "started_at": "2025-05-07T12:34:56Z", "url": "https://status.example.com/incidents/1234567890", "components": [ { "id": "component-id", "name": "API", "status": "DEGRADED_PERFORMANCE" } ] } } } } ``` ```json { "api_version": "2025-01-27", "type": "status_page.incident.resolved", "data": { "object": { "object": "status_page", "id": "1234567890", "name": "My Status Page", "subdomain": "my-status-page", "custom_domain": "https://status.example.com", "incident": { "id": "1234567890", "title": "API degraded performance", "impact": "DEGRADED_PERFORMANCE", "started_at": "2025-05-07T12:34:56Z", "url": "https://status.example.com/incidents/1234567890", "components": [ { "id": "component-id", "name": "API", "status": "OPERATIONAL" } ] } } } } ``` -------------------------------- ### SMS alert test message format Source: https://onlineornot.com/docs/how-to/alerts/sms The format of test messages received after successfully connecting a Twilio account. ```text [OnlineOrNot TEST] Example.com is DOWN. [OnlineOrNot TEST] Example.com is UP. ``` -------------------------------- ### onlineornot checks delete Source: https://onlineornot.com/docs/reference/cli-commands Deletes an existing uptime check by ID. ```APIDOC ## onlineornot checks delete ### Description Delete an uptime check. ### Usage `onlineornot checks delete ` ### Arguments - **ID** (string) - Required - Check ID ``` -------------------------------- ### Delete an uptime check Source: https://onlineornot.com/docs/reference/cli-commands Removes an existing uptime check using its ID. ```bash onlineornot checks delete ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.