Monitoring
Monitoring Guide¶
The application includes a fully provisioned and preconfigured monitoring stack that allows you to monitor container performance, resource usage, and logs. This stack is ready to use immediately after installation and is accessible via the monitoring URL.
Monitoring Stack Overview¶
The monitoring stack consists of the following tools:
- cAdvisor: Collects container-level metrics such as CPU, memory, and network usage.
- Promtail: Collects logs from Docker containers and forwards them to Loki.
- Loki: A log aggregation system for storing and querying logs.
- Prometheus: A time-series database for collecting metrics from cAdvisor and other sources.
- Grafana: A visualization and dashboard tool to view metrics and logs.
Key Features¶
- Container Status: View the status of all containers in the application.
- Resource Usage: Monitor CPU, memory, and network usage for each container.
- Log Aggregation: Access centralized logs for all containers.
- Log Search and Error Detection: Search logs for specific terms (e.g.,
ERROR
) to quickly identify issues.
Accessing the Monitoring Dashboard¶
- URL: The monitoring stack is available at:
Text Only
http://$hostname/monitor/
-
Replace
$hostname
with the hostname or IP of your server. -
Default Grafana Credentials:
- Username:
admin
- Password:
admin
For security purposes, it is recommended to change the default credentials after the first login.
Preconfigured Dashboards¶
The monitoring stack comes with preconfigured dashboards in Grafana, ready to use out of the box:
-
Container Metrics Dashboard:
- Displays CPU, memory, and network usage for all containers.
- Helps identify resource bottlenecks or underutilized containers.
-
Log Dashboard:
- Aggregates logs from all containers.
- Allows searching for specific terms (e.g.,
ERROR
,WARNING
) to troubleshoot issues.
-
Overview Dashboard:
- Provides a high-level summary of container health and application performance.
How to Use the Monitoring Tools¶
1. View Container Metrics¶
- Navigate to the Container Metrics Dashboard in Grafana.
- Analyze CPU, memory, and network usage for each container.
- Identify containers that are consuming excessive resources or are underutilized.
2. Search Logs¶
- Navigate to the Log Dashboard in Grafana.
- Use the search bar to filter logs by keywords (e.g.,
ERROR
,WARNING
,INFO
). - Drill down into specific logs to investigate issues.
3. Detect Errors¶
- Use the log search feature to detect errors or warnings in real time.
- Set up alerts in Grafana (optional) to notify you when specific log patterns are detected.
Deployment Details¶
- Network Configuration:
- The monitoring stack uses a Docker network and does not expose any services directly to the host.
-
All components communicate internally within the Docker network.
-
Preconfigured Setup:
- The stack is fully provisioned and preconfigured during installation.
- No additional setup is required after deployment.
Security Recommendations¶
- Change Default Credentials:
-
After the first login, update the default Grafana credentials (
admin:admin
) to a secure username and password. -
Restrict Access:
-
Ensure that access to the monitoring stack is restricted to authorized users only.
-
Monitor Logs for Security Issues:
- Regularly search logs for unusual activity or errors that could indicate security issues.