How d180/cloud-monitoring-and-alerting-system works
1. Repository shape
- This is not a long-running server application; it is a collection of standalone Python monitoring scripts plus setup documentation.
- The core execution unit is each script in scripts/python/, with README.md and docs/setup-guide.md describing how to deploy and schedule them.
2. Primary architectural intent
- The system is a distributed endpoint monitoring and alerting design for cloud VMs, especially Windows Server and Linux.
- It focuses on four operational domains: performance, disk capacity, service health, security login failures, and backup status.
3. Monitoring agents / scripts
- cpu_monitor.py checks processor load.
- disk_monitor.py checks storage utilization.
- windows_service_monitor.py checks critical Windows services.
- windows_login_failure_monitor.py checks authentication failures from Windows event logs.
- backup_status_monitor.py verifies backup recency/success.
- In architecture terms, each script is an independent agent that can run on a machine without needing a shared application backend.
4. Data sources
- The scripts consume local machine telemetry rather than a custom database or API layer.
- Inputs are typically:
- OS performance counters / system stats
- Disk state
- Windows service state
- Windows event logs for failed logins
- Backup metadata or logs
- The README also positions the solution against Azure Monitor / AWS CloudWatch, but those are architectural reference points rather than code visible in this repo.
5. Alerting path
- When a threshold or failure condition is detected, the scripts send alerts to external notification channels:
- Email via SMTP
- Microsoft Teams via webhook
- That makes alerting an outbound integration boundary: the repo produces notifications, but does not include a ticketing system or incident dashboard.
6. Operational flow
- The flow is: endpoint state → Python check script → threshold/failure evaluation → alert dispatch.
- There is no shared event bus, central collector, or database in the repository.
- Each script appears to act directly on its local host and emit alerts immediately when conditions are met.
7. Platform boundaries
- The repo explicitly splits behavior by OS:
- Cross-platform-ish checks: CPU and disk monitoring
- Windows-specific checks: service monitoring and failed-login monitoring
- The README notes pywin32 for Windows event/service access, which is an important architectural dependency for the Windows-only scripts.
8. Scheduling and execution model
- These scripts are designed to run on a schedule rather than continuously.
- The intended schedulers are:
- Task Scheduler on Windows
- Cron on Linux
- The schedule cadence in the README is a key part of the architecture: frequent checks for performance and services, slower cadence for security and backup verification.
9. Security and operational assumptions
- The design expects least-privilege execution and careful handling of credentials for outbound alerting.
- Because the scripts monitor system and authentication data, they implicitly require access to privileged local OS APIs/logs.
- No secret-management service is present in the repo; credential handling is left to deployment practice.
10. Documentation and deployment boundary
- docs/setup-guide.md is the main operational guide for installing dependencies and running/scheduling the scripts.
- README.md provides the architecture summary and monitoring scope.
- There is no separate infrastructure-as-code, no CI/CD pipeline, and no packaged deployment artifact in the tree.
11. Important repo-specific note
- The README refers to generic filenames like service_monitor.py and login_failure_monitor.py, but the actual files are named windows_service_monitor.py and windows_login_failure_monitor.py.
- For an architecture diagram, it is safest to treat those as the same conceptual subsystems, with the Windows-specific naming being the authoritative file-tree representation.
12. How to draw the diagram
- Show multiple independent Python monitors on each VM.
- Show local OS data sources feeding each monitor.
- Show outbound alert channels to Email and Teams.
- Optionally show cloud monitoring platforms (Azure Monitor / CloudWatch) as the broader operational context, but not as an implemented component inside this repo.
Main entry points: cpu_monitor.py CPU monitor · disk_monitor.py Disk monitor · windows_service_monitor.py Service monitor · windows_login_failure_monitor.py Login monitor
Components 15
Documentation
Repository guidance for setup and operation.
- README · Architecture summary and monitoring scope.
README.md - Setup guide · Installation and scheduling instructions.
docs/setup-guide.md
Python monitors
Standalone scheduled checks run on each endpoint.
- CPU monitor · Checks processor load on a host.
scripts/python/cpu_monitor.py - Disk monitor · Checks storage utilization on a host.
scripts/python/disk_monitor.py - Service monitor · Checks critical Windows service health.
scripts/python/windows_service_monitor.py - Login monitor · Checks failed Windows authentication events.
scripts/python/windows_login_failure_monitor.py - Backup monitor · Verifies backup recency and success.
scripts/python/backup_status_monitor.py
Local signals
Host telemetry and OS state consumed by the scripts.
- OS stats · Performance counters and system metrics from the host.
- Disk state · Filesystem and capacity information on the endpoint.
- Service state · Windows service status and availability.
- Event logs · Authentication and security events from the local machine.
- Backup data · Backup logs or metadata used to confirm success and freshness.
Outbound alerts
External notification channels used when checks fail.
- Email · Outbound alert delivery via SMTP.
- Teams · Outbound alert delivery via Microsoft Teams webhook.
Execution model
How the scripts are deployed and scheduled on machines.
- Scheduler · Runs the scripts on a schedule rather than continuously.
Connections 22
- README → Setup guide: documents · Repository overview points to operational setup guidance.
- Setup guide → Scheduler: describes · Explains how to run checks with cron or Task Scheduler.
- Scheduler → CPU monitor: runs · Schedules the CPU check on each endpoint.
- Scheduler → Disk monitor: runs · Schedules the disk check on each endpoint.
- Scheduler → Service monitor: runs · Schedules the Windows service check.
- Scheduler → Login monitor: runs · Schedules the Windows login failure check.
- Scheduler → Backup monitor: runs · Schedules the backup verification check.
- CPU monitor → OS stats: reads · Consumes local performance counters and system load.
- Disk monitor → Disk state: reads · Consumes host disk capacity state.
- Service monitor → Service state: reads · Consumes Windows service state via local OS APIs.
- Login monitor → Event logs: reads · Consumes Windows event logs for failed logins.
- Backup monitor → Backup data: reads · Consumes local backup logs or metadata.
- CPU monitor → Email: alerts · Sends threshold alerts by email.
- CPU monitor → Teams: alerts · Sends threshold alerts to Teams.
- Disk monitor → Email: alerts · Sends capacity alerts by email.
- Disk monitor → Teams: alerts · Sends capacity alerts to Teams.
- Service monitor → Email: alerts · Sends service failure alerts by email.
- Service monitor → Teams: alerts · Sends service failure alerts to Teams.
- Login monitor → Email: alerts · Sends security alerts by email.
- Login monitor → Teams: alerts · Sends security alerts to Teams.
- Backup monitor → Email: alerts · Sends backup status alerts by email.
- Backup monitor → Teams: alerts · Sends backup status alerts to Teams.