How mohammadalimehri/system-monitoring-script works
Main Components
• Script Engine: Represent the main script (system_monitor.sh) as the core component.
• System Maintenance Tasks: Components within the script for updating and upgrading packages, cleaning APT cache, and removing unnecessary packages.
• Monitoring Tools: Indicate monitoring commands (vmstat, iostat, mpstat) as subcomponents or processes that collect system performance data.
• Logging Module: A component that handles writing the monitoring logs to files.
• Package Dependency Checker: A module to check and install required packages (like sysstat and curl).
• Telegram Reporting: A component that formats and sends system reports/logs to a Telegram bot (using provided bot token and chat ID).
• Scheduling (Cron Job): Although not part of the script package itself, include a “Scheduler” component to denote its automation through cron. This illustrates the trigger that running the script every 24 hours.
Representing Relationships and Interactions
• Another branch for “Cache Cleanup” processes.
• A branch that verifies and installs dependencies (sysstat, curl) if needed.
• A branch that processes sending data to the “Telegram Bot API”, possibly indicating external network communication using the provided TOKEN and CHAT_ID.
Architectural Patterns and Design Principles
• Although the script is monolithic in nature, highlight the separation of concerns internally by showing distinct maintenance and monitoring modules.
• Modular structure within the script (even if implemented sequentially) where each task is a clear function or a block.
• Demonstrate dependency and control flow, illustrating how the system checks prerequisites (package installations) before executing monitoring and reporting.
Technologies and Tools to Highlight
• Bash/Shell Scripting (system_monitor.sh)
• Linux command-line utilities (apt, vmstat, iostat, mpstat)
• Telegram Bot API (sending notifications)
• Cron (for automation/scheduling)