### Example Response for "start" Signal Source: https://healthchecks.io/docs/http_api An example of a successful HTTP response from Healthchecks.io after sending a 'start' signal. Includes Ping-Body-Limit header. ```http HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 2 Connection: close Access-Control-Allow-Origin: * Ping-Body-Limit: 100000 OK ``` -------------------------------- ### Example Request for "start" Signal Source: https://healthchecks.io/docs/http_api An example of an HTTP GET request to the Healthchecks.io API to signal the start of a job. Includes Host header. ```http GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/start HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Install Apprise Package Source: https://healthchecks.io/docs/self_hosted_configuration Install the Apprise package to enable the Apprise integration for notifications. ```bash pip install apprise ``` -------------------------------- ### Example Response for Listing Integrations Source: https://healthchecks.io/docs/api This is an example of the JSON response when listing existing integrations. It includes the ID, name, and kind for each channel. ```json { "channels": [ { "id": "4ec5a071-2d08-4baa-898a-eb4eb3cd6941", "name": "My Work Email", "kind": "email" }, { "id": "746a083e-f542-4554-be1a-707ce16d3acc", "name": "My Phone", "kind": "sms" } ] } ``` -------------------------------- ### Healthchecks.io Start Signal Request Example Source: https://healthchecks.io/docs/http_api An example HTTP request to send a start signal to a Healthchecks.io check using its slug. Ensure the Host header is correctly set to hc-ping.com. ```http GET /fqOOd6-F4MMNuCEnzTU01w/database-backup/start HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Start Docker Compose Services Source: https://healthchecks.io/docs/self_hosted_docker Navigate to the docker directory and start the Healthchecks services using Docker Compose. ```bash cd docker docker compose up ``` -------------------------------- ### Example Request for Log Signal Source: https://healthchecks.io/docs/http_api This example demonstrates a POST request to send 'Hello World' as a log signal to a specific check. The 'Content-Type' and 'Content-Length' headers are important for sending body data. ```http POST /fqOOd6-F4MMNuCEnzTU01w/database-backup/log HTTP/1.1 Host: hc-ping.com Content-Type: text/plain Content-Length: 11 Hello World ``` -------------------------------- ### Start SMTP Listener Source: https://healthchecks.io/docs/self_hosted Run the smtpd management command to start an SMTP listener service on a specified port. ```bash $ ./manage.py smtpd --port 2525 ``` -------------------------------- ### Example POST Request for Logging Source: https://healthchecks.io/docs/http_api This example demonstrates a POST request to the /log endpoint, including a request body. The Content-Length header specifies the size of the body sent. ```http POST /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/log HTTP/1.1 Host: hc-ping.com Content-Type: text/plain Content-Length: 11 Hello World ``` -------------------------------- ### Python: Signal Script Start and Success Source: https://healthchecks.io/docs/measuring_script_run_time Use this Python snippet to send a start signal before your script runs and a success signal upon completion. This allows Healthchecks.io to measure the execution time. Ensure the requests library is installed. ```python import requests URL = "https://hc-ping.com/your-uuid-here" # "/start" kicks off a timer: if the job takes longer than # the configured grace time, Healthchecks.io will mark it as "down" try: requests.get(URL + "/start", timeout=5) except requests.exceptions.RequestException: # If the network request fails for any reason, we don't want # it to prevent the main job from running pass # TODO: run the job here fib = lambda n: n if n < 2 else fib(n - 1) + fib(n - 2) print("F(42) = %d" % fib(42)) # Signal success: requests.get(URL) ``` -------------------------------- ### Example Cron Job Definition Source: https://healthchecks.io/docs/monitoring_cron_jobs This is a basic cron job definition that runs a script daily. It serves as a starting point for monitoring. ```bash # run backup.sh at 06:08 every day 8 6 * * * /home/me/backup.sh ``` -------------------------------- ### Example GET Request for Reporting Status Source: https://healthchecks.io/docs/http_api An example GET request to the Healthchecks.io API to report a script's status. The request includes the host and the specific path with ping key, slug, and exit status. ```http GET /fqOOd6-F4MMNuCEnzTU01w/database-backup/1 HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Install Python Requirements Source: https://healthchecks.io/docs/self_hosted Installs project dependencies, including Django, into the activated virtual environment using pip. ```bash $ pip install wheel $ pip install -r healthchecks/requirements.txt ``` -------------------------------- ### Example Ping Request Source: https://healthchecks.io/docs/http_api An example of a GET request to ping a specific Healthchecks.io check with a UUID and an exit status of 1. ```HTTP GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/1 HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Example Request to Send a Signal Source: https://healthchecks.io/docs/http_api This example demonstrates a GET request to the Healthchecks.io API to send a signal for a specific check. Ensure the Host header is correctly set to hc-ping.com. ```http GET /fqOOd6-F4MMNuCEnzTU01w/database-backup HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Run Development Server Source: https://healthchecks.io/docs/self_hosted Starts the Django development server for the Healthchecks application. ```bash $ ./manage.py runserver ``` -------------------------------- ### Install Dependencies Source: https://healthchecks.io/docs/self_hosted Installs necessary system dependencies for Healthchecks development on Debian-based systems. ```bash $ sudo apt-get update $ sudo apt-get install -y gcc python3-dev python3-venv ``` -------------------------------- ### Concrete Slug URL Example Source: https://healthchecks.io/docs/slug_urls A specific example of a Slug URL with a ping key and a descriptive slug. ```url https://hc-ping.com/**fqOOd6-F4MMNuCEnzTU01w**/**db-backups** ``` -------------------------------- ### UUID URL with Signals Source: https://healthchecks.io/docs/slug_urls Examples of using UUID URLs to signal events like start, failure, or log messages with specific exit codes. ```url https://hc-ping.com/d1665499-e827-441f-bf13-8f15e8f4c0b9**/start** ``` ```url https://hc-ping.com/d1665499-e827-441f-bf13-8f15e8f4c0b9**/fail** ``` ```url https://hc-ping.com/d1665499-e827-441f-bf13-8f15e8f4c0b9**/123** ``` ```url https://hc-ping.com/d1665499-e827-441f-bf13-8f15e8f4c0b9**/log** ``` -------------------------------- ### Configure Start Keywords for Email Pings Source: https://healthchecks.io/docs/api Specifies keywords to classify inbound email messages as start signals. Keywords are case-sensitive and can be comma-separated. ```json { "filter_subject": true, "start_kw": "STARTED" } ``` -------------------------------- ### Example Response with Full Permissions Source: https://healthchecks.io/docs/api This JSON shows a typical API response when using a full-access API key. It includes all fields related to check configuration and management. ```json { "checks": [ { "name": "Filesystem Backup", "slug": "filesystem-backup", "tags": "backup fs", "desc": "Runs incremental backup every hour", "grace": 600, "n_pings": 1, "status": "up", "started": false, "last_ping": "2020-03-24T14:02:03+00:00", "next_ping": "2020-03-24T15:02:03+00:00", "manual_resume": false, "methods": "", "start_kw": "START", "success_kw": "SUCCESS", "failure_kw": "ERROR", "filter_subject": true, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/1b9d0386-d07e-44b0-8995-4a9a372de43c.svg", "uuid": "31365bce-8da9-4729-8ff3-aaa71d56b712", "ping_url": "https://hc-ping.com/31365bce-8da9-4729-8ff3-aaa71d56b712", "update_url": "https://healthchecks.io/api/v3/checks/31365bce-8da9-4729-8ff3-aaa71d56b712", "pause_url": "https://healthchecks.io/api/v3/checks/31365bce-8da9-4729-8ff3-aaa71d56b712/pause", "resume_url": "https://healthchecks.io/api/v3/checks/31365bce-8da9-4729-8ff3-aaa71d56b712/resume", "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c", "timeout": 3600 }, { "name": "Database Backup", "slug": "database-backup", "tags": "production db", "desc": "Runs ~/db-backup.sh", "grace": 1200, "n_pings": 7, "status": "down", "started": false, "last_ping": "2020-03-23T10:19:32+00:00", "next_ping": null, "manual_resume": false, "methods": "", "start_kw": "", "success_kw": "", "failure_kw": "", "filter_subject": false, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/7d3ab93d-836e-4505-bbda-fcbd5e07adf9.svg", "uuid": "803f680d-e89b-492b-82ef-2be7b774a92d", "ping_url": "https://hc-ping.com/803f680d-e89b-492b-82ef-2be7b774a92d", "update_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d", "pause_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause", "resume_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d/resume", "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c", "schedule": "15 5 * * *", "tz": "UTC" } ] } ``` -------------------------------- ### Update Check with Start Keywords Source: https://healthchecks.io/docs/api Configure keywords that classify inbound messages or pings as start signals. These keywords are case-sensitive and used in conjunction with filtering options. ```json {"filter_subject": true, "start_kw": "STARTED"} ``` -------------------------------- ### Slug URL with Signals Source: https://healthchecks.io/docs/slug_urls Examples of using Slug URLs to signal events like start, failure, or log messages with specific exit codes. ```url https://hc-ping.com/fqOOd6-F4MMNuCEnzTU01w/db-backups**/start** ``` ```url https://hc-ping.com/fqOOd6-F4MMNuCEnzTU01w/db-backups**/fail** ``` ```url https://hc-ping.com/fqOOd6-F4MMNuCEnzTU01w/db-backups**/123** ``` ```url https://hc-ping.com/fqOOd6-F4MMNuCEnzTU01w/db-backups**/log** ``` -------------------------------- ### Shell: Signal Script Start and Success with Run IDs Source: https://healthchecks.io/docs/measuring_script_run_time This shell script demonstrates how to use `curl` and `uuidgen` to send start and success signals with unique run IDs. This is crucial for accurately measuring run times when multiple instances of the same job can run concurrently. ```shell #!/bin/sh RID=`uuidgen` # send a start ping, specify rid parameter: curl -fsS -m 10 --retry 5 https://hc-ping.com/your-uuid-here/start?rid=$RID # ... FIXME: run the job here ... # send the success ping, use the same rid parameter: curl -fsS -m 10 --retry 5 https://hc-ping.com/your-uuid-here?rid=$RID ``` -------------------------------- ### Example Request for Success Signal Source: https://healthchecks.io/docs/http_api An example of an HTTP request to the success endpoint using a UUID. This demonstrates the basic structure of a request to signal a successful check. ```http GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278 HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Example Request to Signal Failure Source: https://healthchecks.io/docs/http_api An example HTTP request to signal a failure for a specific check. This demonstrates the URL structure and required headers. ```http GET /fqOOd6-F4MMNuCEnzTU01w/database-backup/fail HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Send a "start" Signal (Using Slug) Source: https://healthchecks.io/docs/http_api Use this endpoint to send a "job has started!" message to Healthchecks.io. This is optional but enables features like job execution time measurement and grace time detection. The check is identified by the project's ping key and the check's slug in the URL. ```http HEAD|GET|POST https://hc-ping.com///start ``` -------------------------------- ### Send a "start" Signal (Using Slug) Source: https://healthchecks.io/docs/http_api Sends a "job has started!" message to Healthchecks.io. This signal enables features like job execution time measurement and grace time detection. The check is identified by the project's ping key and the check's slug in the URL. ```APIDOC ## HEAD|GET|POST https://hc-ping.com///start ### Description Sends a "job has started!" message to Healthchecks.io. This signal enables features like job execution time measurement and grace time detection. The check is identified by the project's ping key and the check's slug in the URL. ### Method HEAD|GET|POST ### Endpoint https://hc-ping.com///start ### Query Parameters - **create** (0|1) - Optional - If set to "1", and if the slug in the URL does not match any existing check in the project, Healthchecks.io creates a new check automatically. Default is "0". Example: `create=1` - **rid** (uuid) - Optional - Specifies a run ID of this ping. If run ID is specified, Healthchecks.io uses it to match the correct corresponding completion ping for this ping, and calculate an accurate duration. The value must be a client-picked UUID in the canonical textual representation. Example: `rid=123e4567-e89b-12d3-a456-426614174000` ### Response Codes - **200 OK**: The request succeeded. - **201 Created**: A new check was automatically created, the request succeeded. - **400 invalid url format**: The URL does not match the expected format. - **404 not found**: Could not find a check with the specified ping key and slug combination. - **409 ambiguous slug**: Ambiguous, the slug matched multiple checks. - **429 rate limit exceeded**: Rate limit exceeded. Please do not ping a single check more than 5 times per minute. ### Request Example ``` GET /fqOOd6-F4MMNuCEnzTU01w/database-backup/start HTTP/1.0 Host: hc-ping.com ``` ### Response Example (200 OK) ``` HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 2 Connection: close Access-Control-Allow-Origin: * Ping-Body-Limit: 100000 OK ``` ``` -------------------------------- ### Send a "start" Signal Using UUID Source: https://healthchecks.io/docs/http_api Send a 'job has started!' message to Healthchecks.io. This is optional but enables job execution time measurement and grace time detection. The check is identified by the UUID in the URL. ```http HEAD|GET|POST https://hc-ping.com//start ``` -------------------------------- ### Example Response with Read-Only API Key Source: https://healthchecks.io/docs/api This JSON demonstrates the API response when using a read-only API key. Certain management-related fields are omitted, and a `unique_key` is provided instead of `uuid`. ```json { "checks": [ { "name": "Filesystem Backup", "slug": "filesystem-backup", "tags": "backup fs", "desc": "Runs incremental backup every hour", "grace": 600, "n_pings": 1, "status": "up", "started": false, "last_ping": "2020-03-24T14:02:03+00:00", "next_ping": "2020-03-24T15:02:03+00:00", "manual_resume": false, "methods": "", "start_kw": "START", "success_kw": "SUCCESS", "failure_kw": "ERROR", "filter_subject": true, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/1b9d0386-d07e-44b0-8995-4a9a372de43c.svg", "unique_key": "a6c7b0a8a66bed0df66abfdab3c77736861703ee", "timeout": 3600 }, { "name": "Database Backup", "slug": "database-backup", "tags": "production db", "desc": "Runs ~/db-backup.sh", "grace": 1200, "n_pings": 7, "status": "down", "started": false, "last_ping": "2020-03-23T10:19:32+00:00", "next_ping": null, "manual_resume": false, "methods": "", "start_kw": "", "success_kw": "", "failure_kw": "", "filter_subject": false, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/7d3ab93d-836e-4505-bbda-fcbd5e07adf9.svg", "unique_key": "124f983e0e3dcaeba921cfcef46efd084576e783", "schedule": "15 5 * * *", "tz": "UTC" } ] } ``` -------------------------------- ### Execute PowerShell Command Directly Source: https://healthchecks.io/docs/powershell This example demonstrates how to pass a PowerShell command directly to the PowerShell executable using the '-Command' argument, avoiding the need for a .ps1 file. ```powershell # Pass the command to PowerShell directly: powershell.exe -Command "&{Invoke-RestMethod https://hc-ping.com/your-uuid-here}" ``` -------------------------------- ### Prepare Project Directory Source: https://healthchecks.io/docs/self_hosted Creates a directory for the project code and virtual environment. ```bash $ mkdir -p ~/webapps $ cd ~/webapps ``` -------------------------------- ### Prepare Virtual Environment Source: https://healthchecks.io/docs/self_hosted Sets up a Python virtual environment named 'hc-venv' and activates it. ```bash $ python3 -m venv hc-venv $ source hc-venv/bin/activate ``` -------------------------------- ### List Existing Integrations Source: https://healthchecks.io/docs/api Use this endpoint to retrieve a list of all integrations configured for your project. Requires an API key for authentication. ```bash curl --header "X-Api-Key: your-api-key" https://healthchecks.io/api/v3/channels/ ``` -------------------------------- ### Create a New Check using API Key Authentication Source: https://healthchecks.io/docs/api This example demonstrates how to create a new check using the `X-Api-Key` header for authentication. It includes basic check parameters like name, tags, timeout, and grace period. ```bash curl https://healthchecks.io/api/v3/checks/ \ --header "X-Api-Key: your-api-key" \ --data '{"name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}' ``` -------------------------------- ### Node.js HTTP Ping Source: https://healthchecks.io/docs/javascript A minimal example of making an HTTP GET request to Healthchecks.io using Node.js's built-in 'https' module. This method is asynchronous and may lead to race conditions if not handled carefully. ```javascript var https = require('https'); https.get('https://hc-ping.com/your-uuid-here').on('error', (err) => { console.log('Ping failed: ' + err) }); ``` -------------------------------- ### Create Superuser (Non-Interactive) Source: https://healthchecks.io/docs/self_hosted_docker Create a superuser account by providing credentials directly as command-line arguments. ```bash docker compose run web /opt/healthchecks/manage.py createsuperuser --email user@example.com --password changeme123 ``` -------------------------------- ### Configure Matrix Integration Environment Variables Source: https://healthchecks.io/docs/self_hosted_configuration Set these environment variables to enable and configure the Matrix integration for posting notifications. Ensure you have registered a bot user and obtained its access token. ```bash MATRIX_ACCESS_TOKEN=[a long string of characters returned by the login call] MATRIX_HOMESERVER=https://matrix.org MATRIX_USER_ID=@mychecks:matrix.org ``` -------------------------------- ### Node.js Async/Await Ping with Axios Source: https://healthchecks.io/docs/javascript An example demonstrating how to send pings using async/await and the 'axios' library in Node.js. This approach helps avoid race conditions and includes error handling with a timeout. ```javascript const axios = require("axios"); async function ping(url) { try { await axios.get(url, {timeout: 5000}); } catch(error) { // Log the error and continue. A ping failure should // not prevent the job from running. console.error("Ping failed: " + error); } } async function runJob() { var pingUrl = "https://hc-ping.com/your-uuid-here"; await ping(pingUrl + "/start"); try { console.log("TODO: run the job here"); await ping(pingUrl); // success } catch(error) { await ping(pingUrl + "/fail"); } } runJob(); ``` -------------------------------- ### Create Database Tables and Superuser Source: https://healthchecks.io/docs/self_hosted Applies database migrations to create tables and sets up a superuser account for the Healthchecks application. ```bash $ cd ~/webapps/healthchecks $ ./manage.py migrate $ ./manage.py createsuperuser ``` -------------------------------- ### Pause Monitoring Response Example Source: https://healthchecks.io/docs/api This is an example of a successful response when a check's monitoring is paused. The 'status' field will be updated to 'paused'. ```json { "name": "Backups", "slug": "", "tags": "prod www", "desc": "", "grace": 60, "n_pings": 0, "status": "paused", "started": false, "last_ping": null, "next_ping": null, "manual_resume": false, "methods": "", "subject": "", "subject_fail": "", "start_kw": "", "success_kw": "", "failure_kw": "", "filter_subject": false, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/d43c84db-1502-4d86-a89d-181a33e25896.svg", "uuid": "7918b17b-a745-4db1-8575-9d2e07c97f79", "ping_url": "https://hc-ping.com/7918b17b-a745-4db1-8575-9d2e07c97f79", "update_url": "https://healthchecks.io/api/v3/checks/7918b17b-a745-4db1-8575-9d2e07c97f79", "pause_url": "https://healthchecks.io/api/v3/checks/7918b17b-a745-4db1-8575-9d2e07c97f79/pause", "resume_url": "https://healthchecks.io/api/v3/checks/7918b17b-a745-4db1-8575-9d2e07c97f79/resume", "channels": "", "timeout": 3600 } ``` -------------------------------- ### Example Response for Listing Project Badges Source: https://healthchecks.io/docs/api This JSON response provides URLs for various badge formats (SVG, JSON, Shields.io) and states (2-state, 3-state) for each tag, including an overall project status ('*'). ```json { "badges": { "backup": { "svg": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.svg", "svg3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.svg", "json": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.json", "json3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.json", "shields": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.shields", "shields3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.shields" }, "db": { "svg": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.svg", "svg3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.svg", "json": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.json", "json3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.json", "shields": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.shields", "shields3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.shields" }, "prod": { "svg": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.svg", "svg3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.svg", "json": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.json", "json3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.json", "shields": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.shields", "shields3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.shields" }, "*": { "svg": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.svg", "svg3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.svg", "json": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.json", "json3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.json", "shields": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.shields", "shields3": "https://healthchecks.io/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.shields" } } } ``` -------------------------------- ### Create Superuser (Interactive) Source: https://healthchecks.io/docs/self_hosted_docker Run the command to create a superuser account for Healthchecks. This will prompt for credentials. ```bash docker compose run web /opt/healthchecks/manage.py createsuperuser ``` -------------------------------- ### Example Response for Success Signal Source: https://healthchecks.io/docs/http_api An example of a successful HTTP response from the Healthchecks.io API. It includes headers like 'Content-Type', 'Content-Length', and 'Ping-Body-Limit'. ```http HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 2 Connection: close Access-Control-Allow-Origin: * Ping-Body-Limit: 100000 OK ``` -------------------------------- ### Common Cron Expression: At the start of every third month Source: https://healthchecks.io/docs/cron A common cron expression for running a task at the start of every third month. ```cron 0 0 1 */3 * ``` -------------------------------- ### Example Request to Signal Failure Source: https://healthchecks.io/docs/http_api An example HTTP request to the Healthchecks.io API to signal a job failure. Ensure the Host header is correctly set to hc-ping.com. ```http GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/fail HTTP/1.0 Host: hc-ping.com ``` -------------------------------- ### Enable Auto Provisioning with Slug Source: https://healthchecks.io/docs/autoprovisioning Append `?create=1` to a slug-based ping endpoint to enable auto provisioning. Healthchecks.io will create the check if it does not exist. ```bash # Do some work sleep 5 # Send success signal to Healthchecks.io curl -m 10 --retry 5 https://hc-ping.com/my-ping-key/srv01?create=1 ``` -------------------------------- ### List Checks with API Key Source: https://healthchecks.io/docs/api Demonstrates how to authenticate an API request to list checks using an X-Api-Key header. ```bash curl --header "X-Api-Key: your-api-key" https://healthchecks.io/api/v3/checks/ ``` -------------------------------- ### Create Superuser Account (Interactive) Source: https://healthchecks.io/docs/self_hosted Use this command to create a superuser account interactively for accessing the Django administration panel. ```bash $ ./manage.py createsuperuser ``` -------------------------------- ### Get a single check Source: https://healthchecks.io/docs/api Retrieves details for a specific check using its UUID or unique key. ```APIDOC ## GET /api/v3/checks/ ### Description Retrieves details for a specific check using its UUID. ### Method GET ### Endpoint /api/v3/checks/ ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the check. ``` ```APIDOC ## GET /api/v3/checks/ ### Description Retrieves details for a specific check using its unique key. ### Method GET ### Endpoint /api/v3/checks/ ### Parameters #### Path Parameters - **unique_key** (string) - Required - The unique key of the check. ``` -------------------------------- ### Send a "start" Signal Using UUID Source: https://healthchecks.io/docs/http_api Sends a 'job has started!' message to Healthchecks.io. This signal enables features like job execution time measurement and grace time detection. The check is identified by the UUID in the URL. The response may include a 'Ping-Body-Limit' header indicating the maximum bytes of the request body to store. ```APIDOC ## HEAD|GET|POST https://hc-ping.com//start ### Description Sends a "job has started!" message to Healthchecks.io. This signal is optional but enables features such as measuring job execution times and detecting if a job runs longer than its configured grace time. Healthchecks.io identifies the check by the UUID in the URL. The response may optionally contain a `Ping-Body-Limit: ` header, specifying how many bytes of the request body Healthchecks.io will store per request. ### Method HEAD, GET, POST ### Endpoint `https://hc-ping.com//start` ### Parameters #### Query Parameters - **rid** (uuid) - Optional - Specifies a run ID for this ping, used to match the corresponding completion ping and calculate an accurate duration. The value must be a client-picked UUID in canonical textual representation. Example: `rid=123e4567-e89b-12d3-a456-426614174000`. ### Response Codes - **200 OK**: The request succeeded. - **200 OK (not found)**: Could not find a check with the specified UUID. - **200 OK (rate limited)**: Rate limit exceeded; request was ignored. Do not ping a single check more than 5 times per minute. - **400 invalid url format**: The URL does not match the expected format. ### Request Example ``` GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/start HTTP/1.0 Host: hc-ping.com ``` ### Response Example ``` HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 2 Connection: close Access-Control-Allow-Origin: * Ping-Body-Limit: 100000 OK ``` ``` -------------------------------- ### Get a Single Check Source: https://healthchecks.io/docs/api Retrieves a JSON representation of a single check. You can identify the check using its UUID or its `unique_key`. ```APIDOC ## GET /api/v3/checks/ ### Description Returns a JSON representation of a single check. Accepts either the check's UUID or the `unique_key` as an identifier. ### Method GET ### Endpoint `/api/v3/checks/` or `/api/v3/checks/` ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the check. - **unique_key** (string) - Required - A stable identifier for the check, provided in read-only API responses. ### Request Example ```bash curl --header "X-Api-Key: your-api-key" https://healthchecks.io/api/v3/checks/ ``` ### Response #### Success Response (200) - **name** (string) - The name of the check. - **slug** (string) - A URL-friendly identifier for the check. - **tags** (string) - Tags associated with the check. - **desc** (string) - A description of the check. - **grace** (integer) - Grace period in seconds before a check is considered down. - **n_pings** (integer) - The number of pings received. - **status** (string) - The current status of the check (new, up, grace, down, paused). - **started** (boolean) - Whether the check has started receiving pings. - **last_ping** (string) - The timestamp of the last received ping. - **next_ping** (string or null) - The timestamp of the next expected ping. - **manual_resume** (boolean) - Whether manual resume is enabled. - **methods** (string) - Associated methods. - **start_kw** (string) - Keyword to start the check. - **success_kw** (string) - Keyword for successful ping. - **failure_kw** (string) - Keyword for failed ping. - **filter_subject** (boolean) - Whether to filter by subject. - **filter_body** (boolean) - Whether to filter by body. - **filter_http_body** (boolean) - Whether to filter by HTTP body. - **filter_default_fail** (boolean) - Whether to filter by default fail. - **badge_url** (string) - URL for the check's badge. - **uuid** (string) - The unique identifier of the check (omitted in read-only responses). - **ping_url** (string) - The URL to ping for this check (omitted in read-only responses). - **update_url** (string) - The URL to update this check (omitted in read-only responses). - **pause_url** (string) - The URL to pause this check (omitted in read-only responses). - **resume_url** (string) - The URL to resume this check (omitted in read-only responses). - **channels** (string) - Associated channels (omitted in read-only responses). - **schedule** (string) - The cron schedule for the check. - **tz** (string) - The timezone of the check. - **unique_key** (string) - A stable identifier for the check (included in read-only responses). #### Response Example ```json { "name": "Database Backup", "slug": "database-backup", "tags": "production db", "desc": "Runs ~/db-backup.sh", "grace": 1200, "n_pings": 7, "status": "down", "started": false, "last_ping": "2020-03-23T10:19:32+00:00", "next_ping": null, "manual_resume": false, "methods": "", "start_kw": "START", "success_kw": "SUCCESS", "failure_kw": "ERROR", "filter_subject": true, "filter_body": false, "filter_http_body": false, "filter_default_fail": false, "badge_url": "https://healthchecks.io/b/2/7d3ab93d-836e-4505-bbda-fcbd5e07adf9.svg", "uuid": "803f680d-e89b-492b-82ef-2be7b774a92d", "ping_url": "https://hc-ping.com/803f680d-e89b-492b-82ef-2be7b774a92d", "update_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d", "pause_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause", "resume_url": "https://healthchecks.io/api/v3/checks/803f680d-e89b-492b-82ef-2be7b774a92d/resume", "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c", "schedule": "15 5 * * *", "tz": "UTC" } ``` #### Error Response - **401 Unauthorized**: The API key is either missing or invalid. - **403 Forbidden**: Access denied, wrong API key. - **404 Not Found**: The specified check does not exist. ``` -------------------------------- ### Send Ping with Curl Source: https://healthchecks.io/docs/bash Sends an HTTP GET request to the Healthchecks.io ping URL. Use this for basic status updates. ```bash # Sends an HTTP GET request with curl: curl -m 10 --retry 5 https://hc-ping.com/your-uuid-here ``` ```bash # Silent version (no stdout/stderr output unless curl hits an error): curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/your-uuid-here ``` -------------------------------- ### Allow Only POST Requests for Pinging Source: https://healthchecks.io/docs/api Restricts ping requests to only use the POST method. By default, HEAD, GET, and POST are allowed. ```json { "methods": "POST" } ``` -------------------------------- ### List existing integrations Source: https://healthchecks.io/docs/api Retrieves a list of all existing integrations (channels) in the account. ```APIDOC ## GET /api/v3/channels/ ### Description Retrieves a list of all existing integrations (channels) in the account. ### Method GET ### Endpoint /api/v3/channels/ ``` -------------------------------- ### Send Ping with Urllib.request Source: https://healthchecks.io/docs/python Utilize Python's built-in 'urllib.request' module for sending a GET ping to Healthchecks.io. Handles potential socket errors. ```python import socket import urllib.request try: urllib.request.urlopen("https://hc-ping.com/your-uuid-here", timeout=10) except socket.error as e: # Log ping failure here... print("Ping failed: %s" % e) ``` -------------------------------- ### List Existing Integrations Source: https://healthchecks.io/docs/api Retrieves a list of all integrations configured for the project. This endpoint is useful for managing and viewing notification channels. ```APIDOC ## List Existing Integrations ### Description Returns a list of integrations belonging to the project. ### Method GET ### Endpoint https://healthchecks.io/api/v3/channels/ ### Parameters #### Headers - **X-Api-Key** (string) - Required - API key for authentication. ### Response #### Success Response (200 OK) - **channels** (array) - A list of integration objects. - **id** (string) - The unique identifier for the integration. - **name** (string) - The name of the integration. - **kind** (string) - The type of integration (e.g., email, sms). ### Response Example (200 OK) ```json { "channels": [ { "id": "4ec5a071-2d08-4baa-898a-eb4eb3cd6941", "name": "My Work Email", "kind": "email" }, { "id": "746a083e-f542-4554-be1a-707ce16d3acc", "name": "My Phone", "kind": "sms" } ] } ``` ### Error Handling - **401 Unauthorized**: The API key is either missing or invalid. ``` -------------------------------- ### Browser XMLHttpRequest Ping Source: https://healthchecks.io/docs/javascript An example of sending a ping from a browser environment using the XMLHttpRequest object. Healthchecks.io supports cross-domain requests by setting the Access-Control-Allow-Origin header. ```javascript var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://hc-ping.com/your-uuid-here', true); xhr.send(null); ``` -------------------------------- ### Get a ping's logged body Source: https://healthchecks.io/docs/api Retrieves the logged body of a specific ping for a check, identified by the check's UUID and ping sequence number. ```APIDOC ## GET /api/v3/checks//pings//body ### Description Retrieves the logged body of a specific ping for a check, identified by the check's UUID and ping sequence number. ### Method GET ### Endpoint /api/v3/checks//pings//body ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the check. - **n** (integer) - Required - The sequence number of the ping. ```