Overview
Theadd command registers a new URL for monitoring. You specify the URL, HTTP method, monitoring frequency, and a contact email for alerts.
Usage
Aliases
a
Description
Theadd command creates a new monitoring entry in the database and registers it with Redis for periodic health checks. When the URL becomes unreachable, alerts will be sent to the specified contact email.
Arguments
The full URL to monitor (e.g.,
https://example.com)The HTTP method to use when checking the URL.Valid values:
getpostputpatchdelete
How often to check the URL.Valid values:
ten_seconds- Check every 10 secondsthirty_seconds- Check every 30 secondsone_minute- Check every minutefive_minutes- Check every 5 minutesthirty_minutes- Check every 30 minutesone_hour- Check every hourtwelve_hours- Check every 12 hourstwenty_four_hours- Check every 24 hours
Email address to receive alerts when the URL is unreachable
Flags
This command has no flags.Examples
Add a URL with default settings
Monitor an API endpoint with POST requests
Monitor a critical service every 10 seconds
Using the short alias
Response
The unique identifier assigned to the newly added URL. Use this ID with other commands like
remove and analysis.Validation
The command performs the following validations:- Required fields: Both
urlandcontact_emailmust be provided - HTTP method: Must be one of: get, post, put, patch, delete
- Frequency: Must be one of the supported monitoring frequencies
- Database connection: Must successfully connect to PostgreSQL
- Redis connection: Must successfully connect to Redis
If
http_method is not provided, it defaults to get. If frequency is not provided, it defaults to five_minutes.Error handling
Missing required argument
Invalid HTTP method
Invalid frequency
What happens after adding a URL?
- The URL is stored in the PostgreSQL database
- The URL is added to the appropriate Redis queue based on its frequency
- If the
guardcommand is running, the URL will be monitored at the next interval - The initial status is set to “pending” until the first check completes
Technical details
- The command automatically refreshes the Redis interval cache after adding the URL
- URLs are stored with metadata including creation timestamp
- The system uses a job queue pattern for efficient monitoring at scale
See also
- guard command - Start monitoring
- list command - View all monitored URLs
- remove command - Remove a URL from monitoring
- analysis command - View URL statistics