1 stable release
new 1.0.1 | Feb 21, 2025 |
---|
#161 in Configuration
38 downloads per month
44KB
817 lines
Data Guardian
Data Guardian is a system service for monitoring and optimizing application data usage. It provides real-time monitoring, alerts, and insights into how applications consume data on your system.
Features
- Real-time Monitoring: Track data usage across all running applications
- Smart Alerts: Receive notifications when applications exceed data thresholds
- Local-First: All data processing happens locally for maximum privacy
- Efficient Storage: Compressed historical data for trend analysis
- Cross-Platform: Supports Linux, macOS, and Windows
- Low Overhead: Minimal system resource usage
- Configurable: Flexible settings for thresholds and intervals
Installation
Prerequisites
- Rust 1.78 or higher
- Cargo package manager
- Platform-specific dependencies:
- Linux:
libdbus-1-dev
- macOS: None
- Windows: None
- Linux:
From Source
# Clone the repository
git clone https://github.com/xosnrdev/data-guardian.git
cd data-guardian
# Build and install
cargo install --path .
From Cargo
cargo install data-guardian
Usage
Quick Start
-
Start the service:
dg
-
The service will run in the background and monitor data usage
-
Receive notifications when applications exceed thresholds
Configuration
The service can be configured in three ways (in order of precedence):
-
Environment variables:
DATAGUARDIAN_DATA_LIMIT=1073741824 DATAGUARDIAN_CHECK_INTERVAL_SECONDS=60 DATAGUARDIAN_PERSISTENCE_INTERVAL_SECONDS=300
-
User configuration file at:
- Linux:
~/.config/DataGuardian/config.toml
- macOS:
~/Library/Application Support/DataGuardian/config.toml
- Windows:
%APPDATA%\DataGuardian\config.toml
Example
config.toml
:# Data limit in bytes before triggering alerts data_limit = 1073741824 # 1 GB # How often to check process data usage (in seconds) check_interval_seconds = 60 # How often to save usage data to disk (in seconds) persistence_interval_seconds = 300 # 5 minutes
- Linux:
-
Default values:
data_limit
: 1 GB (1073741824 bytes)check_interval_seconds
: 60 secondspersistence_interval_seconds
: 300 seconds (5 minutes)
Environment Variables
DATAGUARDIAN_DATA_LIMIT
: Override data limitDATAGUARDIAN_CHECK_INTERVAL_SECONDS
: Override check intervalDATAGUARDIAN_PERSISTENCE_INTERVAL_SECONDS
: Override persistence intervalRUST_LOG
: Set logging level (error, warn, info, debug, trace)
Development
Building
# Build debug version
cargo build
# Build release version
cargo build --release
Testing
# Run all tests
make test
# Run specific test
cargo test test_name
# Run with logging
cargo test -- --nocapture
Code Quality
# Run all checks
make all
# Format code
make fmt
# Run lints
make lint
License
Licensed under the MIT License
Acknowledgments
- sysinfo for system information
- notify-rust for notifications
- tokio for async runtime
Roadmap
- Web interface for data visualization
- Application grouping and categories
- Network interface filtering
- Custom alert rules
- Data usage predictions
- Export and reporting features
Dependencies
~17–45MB
~691K SLoC