This project is not covered by Drupalโs security advisory policy.
Module for proactive API performance and stability monitoring in a Drupal ecosystem.
๐ Overview
The system monitors remote endpoints (Site A) from a control instance (Site B).
It goes beyond simple HTTP status checks by validating response logic and tracking response latency over time.
Main Features
- Guzzle Async: Parallel check execution for maximum performance.
- Plugin System: Each API to monitor is a dedicated Plugin.
- Visual Dashboard: Historical graphs (Chart.js) for analyzing response times.
- Hook System: Extensible via API for custom business logic.
- Swagger: View OpenAPI/Swagger documentation for each endpoint populated with data retrieved from executed requests.
- AI Heuristic Analysis: When enabled on an endpoint, AI Heuristic Analysis scans for sensitive data in responses and notifies you via email if detected.
- AI Chat: Dedicated AI assistant for each endpoint to request test executions or integration code snippets for your system.
๐ ๏ธ Installation & Configuration
1. Requirements
- PHP >= 8.3
- Drupal >= 11.1
- cURL extension enabled
2. Site B Configuration (Monitor)
- Enable the module: `drush en api_monitor_client`.
- Navigate to `/admin/config/development/api-monitoring/settings`.
- Enter the Base Endpoint for Site A.
๐ Notification System (Alerting)
The module includes an active monitoring system that goes beyond logging data to send immediate alerts when anomalies occur.
Alert Configuration
In the settings page (`/admin/config/development/api-monitoring/settings`), you can configure:
- Email Recipients: A comma-separated list of email addresses that will receive error reports.
- Notification Interval: Cooldown time in minutes to prevent email spam if an API remains down for hours.
Drupal Mail Integration
The module leverages Drupal's `MailManager` service.
It is recommended to use modules like SMTP or Symfony Mailer to ensure reliable delivery of notification emails.
The template ID for email theming is `api_status_alert`.
๐ Developer Guide
Create a class inside the `src/Plugin/ApiMonitorProbe/` directory of your custom module:
#[AttributeMonitorProbe(
id: 'check_ordine_invio',
label: new TranslatableMarkup('Check Order Dispatch'),
description: new TranslatableMarkup('Sends a test order to Site A'),
endpoint_id: 'api_ordini_clienti',
method: 'POST'
)]
class CustomServiceProbe extends ApiMonitorProbeBase implements ApiMonitorProbeInterface {
public function validateResponse($response): bool {
// Example: success only if status code is 200 and body status is 'active'
$data = json_decode($response->getBody()->getContents(), TRUE);
return $response->getStatusCode() === 200 && ($data['status'] === 'active');
}
public function getPayload(): array {
return ['id' => 1, 'name' => 'Api monitor Client'];
}
}
๐ Hook Usage (Extensibility)
The module exposes hooks allowing other modules to hook into the workflow:
1. hook_api_monitor_report_alter(array &$results, string $api_id)
Invoked by the Runner after checks are executed but before saving. Allows modifying results or statuses based on custom external logic.
2. hook_api_monitor_probe_info_alter(array &$definitions)
Allows altering plugin definitions (e.g., modifying labels or uptime thresholds) without editing core code.
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Artificial Intelligence (AI), Developer tools
- Created by smarchese on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
