EventPilot is a dynamic platform designed for real-time monitoring and analysis of service events. Utilizing Kafka for event handling and MongoDB for data storage, the architecture allows seamless integration of new monitoring services through a base abstract class.
- /monitor-service: Monitors events from different services.
- /kafka-admin: Manages Kafka server setup and creates topics for monitoring.
- /admin-dashboard: A Next.js frontend that displays near-real-time charts for login failures.
The system's modular architecture enables easy expansion. Services extending the BaseMonitoringService
abstract class inherit methods for connecting to Kafka, subscribing to topics, and processing messages.
Serves as the backbone for all monitoring services, providing essential functionalities such as:
- Kafka connection and subscription management.
- MongoDB integration for data persistence.
- Abstract
processMessage
method to be implemented by each service for specific logic.
This service monitors login attempts, evaluating and responding to login failures. It exemplifies how to implement specific logic on top of the BaseMonitoringService
.
- Node.js
- Docker
- Kafka (set up via Docker-compose)
You can start the services either manually or by using the provided shell script.
In the root directory, execute the start-dev.sh
script:
./start-dev.sh
This script automates the following tasks:
- Starts Kafka and Zookeeper using Docker.
- Waits for Kafka to be ready.
- Starts the Node.js monitoring service.
Kafka Setup
Navigate to the kafka-admin directory and run:
docker-compose up -d
Start Monitor Service
From the monitor-service directory:
npm install
npm run dev
Once the services are operational, the system will actively monitor specified events. Results are logged and stored, with alerts based on predefined conditions.
- Alerts can be configured to be sent through different channels such as Slack or Discord, depending on the severity and type of event detected. Ensure your alert channels are properly configured in the
BaseMonitoringService
for effective notifications.
To add a new monitoring service:
- Extend the BaseMonitoringService class.
- Implement the processMessage method with your custom logic.
- Configure Kafka topics as needed.
Example template for a new service:
import BaseMonitoringService from './BaseMonitoringService';
class CustomMonitoringService extends BaseMonitoringService {
protected processMessage(payload) {
// Insert custom processing logic here.
}
}
Contributions are welcome! Please fork the repository and submit pull requests with your enhancements or fixes.