How pengutronix/monitoring-check-dirvish works
Project type and purpose
• This is a CLI-based monitoring plugin suite for Dirvish backups.
• Its purpose is to check the age and duration of Dirvish vault backups, generate include lists, and emit Nagios-compatible status codes.
File structure
• Top-level scripts:
• check_dirvish.py – main Nagios-style check.
• dirvish_backup_time.py – computes backup age/duration.
• generate_full_backup_includes.py – builds include lists for full backups.
• No subdirectories: all logic lives in these three modules.
• LICENSE.txt and README.md for metadata; no build or deploy scripts.
README for additional insights
• Command-line interface with options for warning/critical thresholds, timeouts, base path, etc.
• Outputs Nagios plugin exit codes and performance data.
• BSD zero-clause license.
Main components and their interactions
a. check_dirvish.py (CLI driver)
• Parses arguments (vault name, thresholds, base path, timeout).
• Calls into dirvish_backup_time.py to get last backup timestamp and duration.
• Optionally invokes generate_full_backup_includes.py for include-file generation.
• Formats output and exits with OK/WARNING/CRITICAL codes.
b. dirvish_backup_time.py (utility module)
• Scans a vault directory on disk (/srv/backup/<vault>/…)
• Determines age of the latest backup and time taken.
• Returns results in a structured form to the caller.
c. generate_full_backup_includes.py (helper module)
• Reads directory trees to build a file-list for full backups.
• Outputs include patterns for Dirvish configuration.
d. File system (Dirvish vault store)
• Physical directory structure under the “base path.”
• Contains backup snapshots, logs, etc.
e. Monitoring system (e.g., Nagios/Icinga)
• Invokes check_dirvish.py on a schedule (via NRPE or local cron).
• Collects service status and performance data.
• Sends alerts when thresholds are crossed.
Architectural patterns and design principles
• Single-responsibility: each script/module focuses on one piece of functionality.
• CLI-driven, composable utilities: small modules invoked by a master script.
• Standard exit codes and perf-data formatting for Nagios integration.
• No external database—relies on the file system as the data source.
Final checklist
• [ ] All three modules (check_dirvish, backup_time, include_generator) clearly represented.
• [ ] Vault file system as a data store.
• [ ] Monitoring server invoking the plugin and receiving statuses.
• [ ] Notes on configurable parameters (base path, thresholds, timeout).
This structure ensures you capture every essential piece of the monitoring plugin architecture without overcomplication.