#426 App: URL Health Monitor (health_monitor)

closed high Created 2025-12-14 20:13 · Updated 2025-12-16 19:42

Description

Edit
## Overview Monitor website/API uptime with scheduled checks and email alerts on failures. ## App Metadata - **App Name:** health_monitor - **Publisher:** platform - **Version:** 1.0.0 - **Priority:** High - **Complexity:** Low - **Phase:** 1 (Quick wins for beta demo) ## Actions ### 1. check_url **Description:** Perform HTTP health check on a single URL **Parameters:** - url (str, required): URL to check - method (str, default='GET'): HTTP method - timeout (int, default=30): Timeout in seconds - expected_status (int, default=200): Expected HTTP status code - expected_content (str, optional): String that must be in response body - headers (dict, optional): Custom headers to send **Returns:** { "url": "https://example.com", "status": "healthy|unhealthy|timeout|error", "status_code": 200, "response_time_ms": 150, "checked_at": "2025-01-01T00:00:00Z", "error": null } ### 2. check_batch **Description:** Check multiple URLs in parallel **Parameters:** - urls (list[dict], required): List of URL configs (same params as check_url) - fail_fast (bool, default=False): Stop on first failure **Returns:** List of check_url results ### 3. send_alert **Description:** Send alert notification for failed checks **Parameters:** - check_result (dict, required): Result from check_url - alert_email (str, required): Email to notify - include_details (bool, default=True): Include response details ## Example Workflow builder = WorkflowBuilder(name='monitor_production', version='1.0.0') builder.task( task_id='check_api', function='apps.platform.health_monitor.check_url', kwargs={'url': 'https://api.example.com/health', 'timeout': 10, 'expected_status': 200}, result_key='api_health' ) builder.task( task_id='alert_if_down', function='apps.platform.health_monitor.send_alert', kwargs={'check_result': '{{api_health}}', 'alert_email': 'ops@example.com'}, condition="api_health.status \!= 'healthy'" ) ## Implementation Notes - Use httpx for async HTTP requests (already in project) - Support for SSL certificate validation (optional skip) - Consider adding webhook alert option in future - Log all checks to DataShard for historical analysis - Reuse existing SMTP infrastructure for email alerts ## Configuration Schema {"default_timeout": 30, "max_retries": 3, "retry_delay_seconds": 5} ## Secrets Config None required (URLs are public) ## Dependencies - httpx library (already in project) - Email sending (reuse welcome_email SMTP config pattern)

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...