Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The right website-monitoring script depends on the failure you need to detect. Use a lightweight HTTP probe for reachability, status codes, latency, and response content. Use a real browser (such as Playwright) when you must prove that JavaScript, login, checkout, or another multi-step journey works. In both cases, define an explicit pass condition, record enough evidence to diagnose failures, and send the result to an alerting system.

A single successful request only describes what one probe runner could reach from its network location. For meaningful coverage, document the URL, cadence, timeout, success assertions, and probe locations.

1. Decide what “healthy” means

Write the failure definition before writing code. Common checks include:

  • Availability: DNS, TCP, TLS, and HTTP connection complete.
  • Correct response: the status is in the range or exact value you expect (for example, 200).
  • Content assertion: the body contains a stable marker such as a release name or signed-out heading.
  • Performance: response or journey latency stays below your documented threshold.
  • User workflow: a browser can load, authenticate, submit, and observe the expected result.

Match the probe to the risk. HTTP/TCP checks are cheap and fast but cannot prove that client-side rendering or a checkout flow works. Browser checks provide deeper coverage and therefore need more CPU, secrets handling, and careful test-data cleanup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. A small HTTP monitor in Python

This script checks status, elapsed time, and a required text marker. It emits a non-zero exit code for an operator, cron, CI job, or container health check.

#!/usr/bin/env python3
import sys
import time
import requests

URL = "https://example.com/health"
EXPECTED_TEXT = "OK"
TIMEOUT_SECONDS = 15
MAX_SECONDS = 3.0

started = time.perf_counter()
try:
    response = requests.get(
        URL,
        timeout=TIMEOUT_SECONDS,
        headers={"User-Agent": "site-monitor/1.0"},
    )
    elapsed = time.perf_counter() - started
    text_ok = EXPECTED_TEXT in response.text
    status_ok = response.status_code == 200
    passed = status_ok and text_ok and elapsed <= MAX_SECONDS
    print({
        "url": URL,
        "status_code": response.status_code,
        "elapsed_seconds": round(elapsed, 3),
        "status_ok": status_ok,
        "content_ok": text_ok,
        "passed": passed,
    })
    if not passed:
        print("failure_detail: status, content, or latency assertion failed", file=sys.stderr)
        sys.exit(1)
except requests.RequestException as exc:
    elapsed = time.perf_counter() - started
    print({"url": URL, "elapsed_seconds": round(elapsed, 3), "passed": False}, file=sys.stderr)
    print(f"request_error: {exc}", file=sys.stderr)
    sys.exit(2)

Install the only dependency with python -m pip install requests. Keep the marker stable; a marketing headline or rotating timestamp creates false alarms. Do not print cookies, authorization headers, or response bodies that may contain personal data.

Quick cURL probe

For a basic status and timing check, use:

curl --fail --silent --show-error --max-time 15 
  --output /dev/null 
  --write-out 'status=%{http_code} total_seconds=%{time_total}n' 
  https://example.com/health

--fail makes HTTP errors fail the command, while --write-out preserves useful timing for logs. Add a separate content check when status alone is insufficient.

3. Preserve evidence and alert on action

Every run should record at least timestamp, target identity, probe location, pass/fail state, status code, duration, and a bounded error detail. Send failures to the system your team already watches—an incident platform, email, chat, or ticket queue. Alert after a sensible number of consecutive failures when transient network errors are common, but do not hide a sustained outage behind aggressive retries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a monotonic timer for elapsed time, set connect and overall timeouts, and cap logged response data. If a check mutates data, use a dedicated account and idempotent records so repeated runs do not create orders, messages, or charges.

Rank #2
AT-A-GLANCE Undated Website Address Book and Password Keeper, Black, 3.63 x 6.13 x .21 Inches (80-500-05)
  • Bookbound planner helps you keep track of passwords and favorite websites
  • Room for over 200 entries; 3.5 x 6 inch page sizes
  • User name and security questions field
  • Tips for what makes a strong password; web resources; notes pages
  • Printed on quality paper containing 30% post-consumer waste; black simulated leather cover; 3.63 x 6.13 x .21 inches

4. Prometheus Blackbox Exporter for external probes

Prometheus’ multi-target exporter guide demonstrates passing a target and configured module to Blackbox Exporter:

curl 'localhost:9115/probe?target=prometheus.io&module=http_2xx'

The exporter exposes metrics for DNS lookup, HTTP phases, status code, TLS details, and certificate expiry. Prometheus periodically scrapes that endpoint; the exact interval is a workload decision, not a universal five-second rule.

Keep the website as the target label

A common production mistake is allowing the exporter address to become the Prometheus instance label. Preserve the URL being tested with relabeling (or the equivalent target-preservation configuration) so dashboards and alerts identify the failed website, not merely the exporter host. A minimal scrape job is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
scrape_configs:
  - job_name: blackbox-http
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
          - https://example.com/health
          - https://status.example.net/
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115

Configure alerts from the resulting metrics, for example when the probe success metric is false or latency exceeds your service objective. Blackbox modules determine what “success” means; review the module’s status, TLS, and content settings rather than assuming every HTTP 200 is healthy.

5. Browser journey monitoring with Playwright

Use a browser when the important assertion is visible page content or a sequence of actions. This example checks a stable heading and writes a machine-readable result:

import { chromium } from "@playwright/test";

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
const started = Date.now();
try {
  await page.goto("https://example.com", { waitUntil: "domcontentloaded", timeout: 30000 });
  await page.getByRole("heading", { name: "Example Domain" }).waitFor({ timeout: 10000 });
  console.log(JSON.stringify({
    passed: true,
    elapsed_ms: Date.now() - started,
    url: page.url()
  }));
} catch (error) {
  console.error(JSON.stringify({
    passed: false,
    elapsed_ms: Date.now() - started,
    error: String(error)
  }));
  process.exitCode = 1;
} finally {
  await browser.close();
}

Install Playwright with npm install @playwright/test and its browser binaries according to the project’s installation instructions. Prefer accessible roles, labels, and other stable selectors over CSS classes generated by a build. Capture a screenshot or trace only when needed for diagnosis, and redact secrets before storing artifacts.

Authentication and side effects

  • Store credentials in the runner’s secret manager, never in source control or console output.
  • Use a least-privilege synthetic account and rotate it.
  • Prepare deterministic test data and clean it up, or use a non-mutating path.
  • Wait for a specific UI state, not an arbitrary long sleep; retain a short timeout margin for slower regions.
  • Decide whether a third-party dependency is part of your success criterion. Otherwise, mock or isolate it to avoid blaming your site for an external outage.

A practical scheduled example

The Playwright Synthetic Monitoring project illustrates running tests periodically in Docker, exposing Prometheus metrics and a health endpoint. Its README describes a default five-minute interval that can be configured and notes that the project does not deliver alerts itself. Treat those as properties of that example, not Playwright defaults; connect its metrics or health endpoint to your own alerting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Choose an execution model

Approach Best for Trade-offs
Local script or cron One endpoint, a small team, or a private network You operate scheduling, history, redundancy, and alert delivery.
Prometheus plus Blackbox Exporter Teams already storing metrics and writing PromQL alerts Excellent protocol metrics; browser workflows require a separate runner.
Managed synthetic service Hosted probes, retained results, and multiple locations Review service limits, privacy, configuration, and regional behavior.
Self-hosted Playwright worker Login, JavaScript, and multi-step journeys Higher runtime and maintenance cost; secrets and test data need operational controls.

Relevant documented options include Prometheus, Google Cloud synthetic monitoring, Grafana Cloud Synthetic Monitoring, and the New Relic Synthetics REST API. Their current prices and plan limits are not established here, so verify those details before choosing.

7. Location, cadence, and interpretation

A check reports what one runner could reach from one network location. Run from more than one region when geography matters, and label each result with its location. Google Cloud documents public checks from multiple global locations and selectable checker regions, but says request data is not guaranteed to remain in a specific geographic location. For Cloud Run-function synthetic monitors, invocation can occur from any region supported by uptime-check servers; selecting a function region does not configure the entire monitoring path.

Google Cloud’s documentation describes synthetic monitors as periodically issuing simulated requests, recording whether they succeeded, and recording additional request data such as latency. Set cadence according to user impact, rate limits, and cost. A five-second scrape may be suitable for a tutorial or a narrowly scoped target, but it can create unnecessary load in production.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

8. Troubleshooting common failures

DNS or connection timeout

Check resolver behavior, firewall rules, proxy settings, and IPv4 versus IPv6 from the runner. Compare from a second location before declaring a global outage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HTTP 200 but the monitor fails

Your content assertion may be absent, personalized, compressed differently, or rendered only by JavaScript. Inspect a bounded response sample, verify redirects, and move to a browser assertion if the user-visible content is client-rendered.

Browser test times out

Capture the failing URL and console/network error, then replace brittle selectors and arbitrary sleeps with explicit state waits. Check that the runner has the required browser dependencies and enough CPU.

Intermittent alerts

Separate connect, TLS, server, and content timings. Use a small consecutive-failure window, but preserve every failed sample so an operator can distinguish a regional network problem from an application regression.

Prometheus labels show the exporter

Inspect relabeling. The target URL must be copied into __param_target and then into instance before replacing __address__ with the exporter endpoint.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Password Book with Alphabetical Tabs, Password Keeper for Seniors 5.3"x7.7"
  • 【Featured A-Z Tabs & Untitle for Security】Our password books have recognizable alphabetical tabs with the colorful design allow you to locate quickly and save time. The anonymous cover of our password keeper is unobtrusive and stays secure.
  • 【Premium Quality & Perfect Size】This password journal features a eco-leather hardcover and 100gsm no-bleed paper, equipped with an elastic band, inner pocket, pen loop and bookmark. It comes in medium format (5.3 x 7.7 inches) which is the perfect size you need.
  • 【Clean Layout & Plenty of Space】 Each tab has 6 pages with 4 entries per page and contains more than 552 passwords in our password organizer. This password notebook also provides more password space in case you need to change your password.
  • 【Perfect Organization & Safe Placement】We ensure this password log book provides you with a secure space to keep passwords and web addresses. You won't have to worry about passwords being leaked or hacked.
  • 【Thoughtful Gift & Warm Heart】 Considering for practical gifts for family or friends? Our specially designed internet password book is sturdy and easy to use. Ideal for any occasion, it's a gift that truly shows care.

Or skip the browser setup

When you need a rendered capture for visual evidence or a browser-oriented check, ScreenshotNeo provides a single-call screenshot API and an MCP server for AI agents. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing state.

Request a WebP image with cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for options such as full-page and element captures, device and retina settings, waiting for selectors or network idle, custom headers and cookies, blocking requests, JavaScript, PDFs, caching, asynchronous webhooks, bulk capture, and usage reporting. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

FAQ

Should I monitor the homepage or a health endpoint?

Prefer a purpose-built health endpoint for dependency and status checks, then add a separate browser journey for the user experience your team must protect.

Can a screenshot prove uptime?

No. A screenshot demonstrates that a rendering request produced an image; pair it with HTTP or browser assertions and explicit alerting for availability monitoring.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How many probe locations do I need?

Use one location for a private, single-region service only when that matches your users. Add locations where regional reachability or latency is part of the requirement.

Quick Recap

SaleBestseller No. 1
Bestseller No. 2
AT-A-GLANCE Undated Website Address Book and Password Keeper, Black, 3.63 x 6.13 x .21 Inches (80-500-05)
AT-A-GLANCE Undated Website Address Book and Password Keeper, Black, 3.63 x 6.13 x .21 Inches (80-500-05)
Bookbound planner helps you keep track of passwords and favorite websites; Room for over 200 entries; 3.5 x 6 inch page sizes
$9.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.