Skip to main content

Your First Monitor

This guide walks through adding a service to monitor via the API. The frontend dashboard provides the same workflow visually.

Prerequisites

You need a valid JWT token from POST /api/v1/auth/login. See Authentication →.

export WK_TOKEN="eyJhbGci..."

Step 1: Create a service

curl -X POST http://localhost:3001/api/v1/services \
-H "Authorization: Bearer $WK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My API",
"endpoint": "https://api.yourapp.com/health",
"check_type": "HTTP",
"check_interval_seconds": 60,
"timeout_seconds": 10,
"environment": "production"
}'

Required fields: name, endpoint, check_type

Defaults: check_interval_seconds=60, timeout_seconds=10

The response includes the service id — save it:

export SVC_ID="550e8400-e29b-41d4-a716-446655440000"

Step 2: Check it's being monitored

The scheduler polls active services and runs checks every ~60 seconds. After a minute, view check results:

curl "http://localhost:3001/api/v1/services/$SVC_ID/checks" \
-H "Authorization: Bearer $WK_TOKEN"

Each check result shows:

  • status: GREEN, YELLOW, or RED
  • response_time_ms: how long the check took
  • status_code: HTTP status code (for HTTP checks)
  • checked_at: timestamp

Step 3: View uptime

# Default: uptime over the last 30 days
curl "http://localhost:3001/api/v1/services/$SVC_ID/uptime" \
-H "Authorization: Bearer $WK_TOKEN"

# Custom date range (RFC3339)
curl "http://localhost:3001/api/v1/services/$SVC_ID/uptime?from=2026-02-01T00:00:00Z&to=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer $WK_TOKEN"

Step 4: Create an alert rule

Get notified when the service goes RED or YELLOW:

curl -X POST http://localhost:3001/api/v1/alert-rules \
-H "Authorization: Bearer $WK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"service_id": "'$SVC_ID'",
"name": "My API Down",
"severity": "critical"
}'

Step 5: Add a notification channel

# Slack via webhook URL
curl -X POST http://localhost:3001/api/v1/notification-channels \
-H "Authorization: Bearer $WK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Slack Alerts",
"channel_type": "slack",
"config": {"webhook_url": "https://hooks.slack.com/services/..."}
}'

Step 6: Trigger a manual check

Test your setup by triggering an immediate check:

curl -X POST "http://localhost:3001/api/v1/services/$SVC_ID/check" \
-H "Authorization: Bearer $WK_TOKEN"

Response: {"status": "check enqueued"}

Monitor configuration reference

FieldDefaultDescription
check_interval_seconds60How often checks run
timeout_seconds10Failure if no response within this time
environmentLabel: production, staging, dev
descriptionOptional human-readable notes
tags[]JSON array of string labels

Check types

See the full check type table → — AlertifyPro supports HTTP, TCP, DNS, PING, WebSocket, SMTP, Redis, MySQL, PostgreSQL, gRPC, and more.