# Monitoring — URL Health Checks

> Know your services are running — before customers notice

Monitor URL availability with configurable intervals. Track uptime over 24h, 7 days, and 30 days, measure response times, and browse full check history.

## Features

- **Configurable interval**: Check every minutes, hours, or days. Flexible units stored as raw values in the database.
- **Uptime 24h / 7d / 30d**: Availability percentage computed with SQL CASE statement. See the trend at a glance.
- **Response time measurement**: Time in milliseconds for each check. Average time from last 24h displayed on detail page.
- **Check history with pagination**: 25 checks per page. Each with status (success/error), response time, and timestamp.
- **Toggle without deleting**: On/off toggle pauses monitoring without losing history and configuration.
- **SSRF protection**: Blocks localhost, private IPs, and link-local addresses. Resolves DNS and validates IP before making the request.

## How it works

1. **Add a monitor**: Enter URL and check interval (e.g., every 5 minutes). Maximum 20 monitors per project.
2. **Worker checks periodically**: Separate worker process makes HTTP requests in the background with asyncio.gather() for concurrent checks.
3. **Results saved to history**: Each check is a database record: timestamp, response time (ms), success/failure.
4. **Analyze in the dashboard**: Detail page shows uptime trend, average response time, and full history.

## AI and MCP

Your AI agent can create, edit, and delete monitors, track status and metrics — 5 MCP tools.

- `list_monitors`: All monitors with last check status
- `get_monitor`: Full history with pagination, uptime metrics, average response time
- `create_monitor`: Create a new URL monitor with interval and expected status
- `update_monitor`: Edit monitor name, URL, interval or expected status
- `delete_monitor`: Delete a monitor with its check history

## Technical details

- **Worker**: Separate process (python -m monolynx.worker). Database advisory lock ensures only one worker runs at a time.
- **Concurrent checking**: asyncio.gather() runs all checks simultaneously. ThreadPoolExecutor for the actual HTTP requests.
- **SSRF**: Validation: DNS resolution → ipaddress module → block private/loopback/link-local. Protects against internal network attacks.
- **Limit**: 20 monitors per project. Prevents excessive worker load.
