1. System Structure
-
Monitoring Server:
- Operating System: Windows with Docker installed
- Tools Deployed as Docker Containers:
- Prometheus Server: Collects and stores data from monitored services.
- Node Exporter: Collects metrics from the Windows host system.
- Alertmanager: Manages and sends alert notifications based on defined rules.
- Grafana: Creates dashboards and displays data from Prometheus and Loki.
- cAdvisor: Collects metrics about Docker containers running on the host.
- Loki: Centralized log aggregation system.
- Promtail: Collects logs from the host and Docker containers and forwards them to Loki.
- Redis: Serves as a caching layer or message broker for various services.
- Pushgateway: Allows ephemeral or batch jobs to expose their metrics to Prometheus.
- AI Model for Security Monitoring: Analyzes traffic and logs to detect SQL injection and Cross-Site Scripting (XSS) attacks.
- Functions:
- System and container metrics collection
- Log aggregation and monitoring
- Alerting and notification management
- Visualizing metrics and logs through dashboards
- Security threat detection using AI
-
Monitored Server:
- Operating System: Kali Linux
- IP Address:
192.168.197.135
- Tools Installed:
- Node Exporter: Collects system metrics and exposes them to Prometheus.
- DVWA (Damn Vulnerable Web Application): A web application used to test and practice common web vulnerabilities.
- Function:
- Provides system metrics to Prometheus.
- Serves as a target for security monitoring and testing by the AI model.
2. Data Flow
-
Prometheus Server on the Windows Docker host collects data from:
- Node Exporter on Windows Host: Metrics about the Windows system.
- Node Exporter on Kali Linux (
192.168.197.135): Metrics from the remote server.
- cAdvisor: Metrics about Docker containers running on the Windows host.
- Pushgateway: Metrics pushed from short-lived batch jobs or scripts.
-
Promtail collects logs from:
- Windows Host and Docker Containers: Forwards logs to Loki for aggregation.
-
Loki stores and indexes logs received from Promtail.
-
Alertmanager is integrated with Prometheus to manage and route alerts.
-
Grafana connects to both Prometheus and Loki to retrieve metrics and logs for dashboard creation.
-
AI Model analyzes data and logs to detect SQL and XSS attacks, feeding results back into the monitoring system.
3. Model Operation
a. Data Collection from Kali Linux Server:
- Node Exporter on Kali Linux collects system metrics (CPU, memory, disk, network, etc.).
- Metrics are exposed via an HTTP endpoint on port
9100.
- Prometheus Server accesses this endpoint to scrape metrics at regular intervals.
b. Data Collection from Windows Host:
- Node Exporter runs in a Docker container, collects metrics from the Windows host.
- cAdvisor monitors Docker containers, providing detailed metrics about resource usage.
- Prometheus Server scrapes metrics from both Node Exporter and cAdvisor.
c. Log Collection and Aggregation:
- Promtail collects logs from the Windows host and Docker containers.
- Logs are forwarded to Loki for centralized storage and indexing.
- Grafana can query Loki to visualize logs alongside metrics.
d. AI Model for Security Monitoring:
- Processes logs and network data to detect security threats such as SQL injections and XSS attacks.
- Integrates with DVWA on the Kali server to simulate attack scenarios.
- Alerts are generated and sent to Alertmanager when threats are detected.
e. Prometheus Server Operation:
- Scrapes metrics from all configured targets (Node Exporters, cAdvisor, Pushgateway).
- Stores metrics in a time-series database.
- Evaluates alerting rules and sends alerts to Alertmanager when conditions are met.
f. Alertmanager Operation:
- Receives alerts from Prometheus and the AI model.
- Processes alerts (grouping, deduplication).
- Routes alerts to configured notification channels (email, Slack, etc.).
g. Grafana Operation:
- Connects to Prometheus for metrics data and Loki for logs.
- Dashboards can display both metrics and logs in a unified view.
- Supports creating alerts based on dashboard panels and predefined thresholds.
- Provides user authentication and role-based access control.
4. Data Processing and Collected Metrics
a. Data Processing:
- Node Exporter and cAdvisor collect and expose metrics in Prometheus-compatible format.
- Prometheus Server scrapes and stores these metrics in its time-series database.
- Promtail collects logs and forwards them to Loki.
- Loki indexes logs, making them searchable through Grafana.
- AI Model analyzes metrics and logs to detect anomalies and security threats.
b. Collected Metrics:
5. Detailed Operation
a. Node Exporter:
- Runs with minimal resource overhead.
- Exposes hardware and OS metrics to Prometheus.
- Listens on default port
9100.
b. cAdvisor:
- Monitors all running Docker containers.
- Collects metrics on resource usage and performance.
- Exposes metrics on an HTTP endpoint for Prometheus to scrape.
c. Prometheus Server:
-
Scraping Mechanism:
- Periodically sends HTTP requests to metrics endpoints.
- Scrape interval is configurable per target.
-
Storage:
- Stores data in a time-series format.
- Retains historical data for querying and visualization.
-
Alerting:
- Rules defined using PromQL expressions.
- Triggers alerts based on metric thresholds or conditions.
d. Pushgateway:
- Accepts metrics from short-lived jobs or scripts.
- Holds metrics until Prometheus scrapes them.
- Useful for batch jobs that start and stop frequently.
e. Promtail and Loki:
-
Promtail:
- Collects logs from files and systemd journals.
- Supports dynamic scraping based on labels.
- Forwards logs to Loki over HTTP.
-
Loki:
- Stores logs efficiently by indexing only metadata.
- Scalable and integrates seamlessly with Grafana.
f. Grafana:
-
Dashboard Creation:
- Customizable panels for metrics and logs.
- Variables and annotations enhance interactivity.
-
Alerting:
- Alerts can be set on metrics thresholds.
- Notifications sent via email, Slack, and other channels.
-
User Management:
- Supports multiple organizations.
- Granular permissions for users and teams.
g. AI Model for Security Threat Detection:
-
Functionality:
- Monitors traffic to the DVWA application.
- Uses algorithms to detect patterns indicative of SQL injection and XSS attacks.
- Can be based on machine learning models trained on attack signatures.
-
Integration:
- Analyzes logs from Loki and real-time data from Prometheus.
- Generates alerts fed into Alertmanager or displayed in Grafana.
-
Response:
- Alerts administrators of detected threats.
- Potentially triggers automated responses (e.g., blocking offending IP addresses).
h. DVWA (Damn Vulnerable Web Application):
- Hosted on the Kali Linux server.
- Provides a platform to test the AI model's effectiveness.
- Simulates real-world vulnerabilities for educational purposes.
6. Additional Tools and Their Roles
a. Redis:
- May be used for:
- Caching queries and frequently accessed data.
- Message brokering between components.
- Supporting rate-limiting mechanisms.
b. Integration and Workflow:
7. Summary
By leveraging Docker on Windows, the monitoring system benefits from containerization, making deployment and management of services more efficient. The addition of tools like cAdvisor, Loki, Promtail, Redis, Pushgateway, and an AI-based security model extends the functionality beyond basic system monitoring to include container insights, centralized logging, and proactive security threat detection. This comprehensive setup ensures robust monitoring, quick detection of issues, and provides a scalable platform for future expansion.