A comprehensive health monitoring system for robotic applications that tracks system resources, sensor status, and provides automated maintenance capabilities.
- CPU Monitoring: Tracks CPU usage with configurable thresholds and alerts
- Memory Monitoring: Monitors RAM usage and detects memory pressure
- Disk Monitoring: Monitors disk space and I/O operations
- Network Monitoring: Tracks network interface statistics and connectivity
- Camera Simulator: Simulates camera sensor operations and health checks
- GPS Simulator: Simulates GPS positioning and signal quality monitoring
- Log Cleanup: Automated log rotation and cleanup utilities
- Service Restart: Automated service restart capabilities for fault recovery
- Centralized logging configuration with rotating file handlers
- Structured logging with different log levels and categories
- Configurable monitoring thresholds and intervals
health-monitor/
├── main.py # Main application entry point
├── logger_config.py # Logging configuration
├── requirements.txt # Python dependencies
├── Dockerfile # Docker container configuration
├── docker-compose.yml # Docker Compose deployment
├── monitor/ # System monitoring modules
│ ├── cpu_monitor.py
│ ├── memory_monitor.py
│ ├── disk_monitor.py
│ └── network_monitor.py
├── sensors/ # Sensor simulation modules
│ ├── camera_simulator.py
│ └── gps_simulator.py
├── auto_fix/ # Automated maintenance scripts
│ ├── cleanup_log.py
│ ├── cleanup_logs
│ └── restart_service.py
└── logs/ # Application logs directory
- Python 3.8 or higher
- Docker and Docker Compose (for containerized deployment)
- Clone the repository:
git clone https://github.com/DipendraChandel/Application-Health-Monitoring.git
cd Application-Health-Monitoring- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtStart the health monitoring system:
python main.pyThe application will start monitoring system resources and log to the logs/ directory.
- Build the Docker image:
docker-compose build- Start the service:
docker-compose up -d- View logs:
docker-compose logs -f- Stop the service:
docker-compose downModify the threshold values in the respective monitor files:
CPU_THRESHOLDinmonitor/cpu_monitor.pyMEMORY_THRESHOLDinmonitor/memory_monitor.pyDISK_THRESHOLDinmonitor/disk_monitor.py
Adjust logging settings in logger_config.py:
- Log levels
- File rotation policies
- Log format
Run the log cleanup script:
python auto_fix/cleanup_log.pyExecute the service restart utility:
python auto_fix/restart_service.py- Create a new monitor file in the
monitor/directory - Implement the monitoring function following the pattern:
def monitor_[resource](stop_event):
while not stop_event.is_set():
# Monitoring logic
# Logging
time.sleep(interval)- Import and add the monitor thread in
main.py
- Create sensor simulator in the
sensors/directory - Implement sensor health checks and data simulation
- Integrate with the main monitoring loop if needed
psutil==7.1.3: System and process utilities for monitoring
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions, please open an issue on the GitHub repository.