Skip to main content

Monitors

Monitors define what Beacon checks and how often. Each monitor can use different check types and be monitored from multiple regions.

Creating Monitors

HTTP Monitor

The most common type - checks that a URL returns the expected status code.
BrainzLab::Beacon.create_monitor(
  name: "Production API",
  type: :http,
  url: "https://api.example.com/health",
  check_interval: 60,
  regions: [:nyc, :london, :singapore],
  expected_status: 200,
  timeout: 10
)

SSL Monitor

Monitors SSL certificate validity and expiry.
BrainzLab::Beacon.create_monitor(
  name: "API SSL Certificate",
  type: :ssl,
  hostname: "api.example.com",
  port: 443,
  check_interval: 3600, # hourly
  warn_days_before_expiry: 30
)

DNS Monitor

Checks DNS resolution and propagation.
BrainzLab::Beacon.create_monitor(
  name: "API DNS",
  type: :dns,
  hostname: "api.example.com",
  record_type: :a,
  expected_value: "1.2.3.4"
)

TCP Monitor

Checks raw TCP port connectivity.
BrainzLab::Beacon.create_monitor(
  name: "Database Port",
  type: :tcp,
  hostname: "db.example.com",
  port: 5432,
  timeout: 5
)

Check Intervals

IntervalBest For
30sCritical production APIs
60sStandard monitoring
300sLower priority services
3600sSSL certificate checks

Regions

Beacon checks from multiple global regions to avoid false positives from network issues.
RegionLocation
nycNew York, USA
londonLondon, UK
singaporeSingapore
sydneySydney, Australia
frankfurtFrankfurt, Germany

Advanced Options

Body Content Check

Verify the response body contains expected content:
BrainzLab::Beacon.create_monitor(
  name: "Health Check",
  url: "https://api.example.com/health",
  expected_body_contains: "status\":\"ok\""
)

Custom Headers

Add authentication or custom headers:
BrainzLab::Beacon.create_monitor(
  name: "Authenticated Endpoint",
  url: "https://api.example.com/internal/status",
  headers: {
    "Authorization" => "Bearer token123",
    "X-Custom-Header" => "value"
  }
)

Request Method

Use different HTTP methods:
BrainzLab::Beacon.create_monitor(
  name: "POST Endpoint",
  url: "https://api.example.com/ping",
  method: :post,
  body: { ping: true }.to_json,
  content_type: "application/json"
)

Monitor States

StateDescription
upAll checks passing
degradedSome regions failing
downAll regions failing
pausedMonitoring disabled
maintenanceIn maintenance window