* also move all at directory root crate * all actors are into lib directory * formatter is into system_monitor now
26 lines
766 B
Rust
26 lines
766 B
Rust
use discord_client::DiscordNotifier;
|
|
use dotenvy::dotenv;
|
|
use system_monitor::SystemMonitor;
|
|
|
|
mod app {
|
|
pub mod service;
|
|
}
|
|
|
|
fn main() {
|
|
dotenv().ok();
|
|
|
|
let notifier = DiscordNotifier::new(
|
|
std::env::var("DISCORD_WEBHOOK").expect("DISCORD_WEBHOOK environment variable not set"),
|
|
"System Monitor".to_string(),
|
|
"https://cdn.shopify.com/s/files/1/0262/1423/6212/files/Lord_of_the_Rings_eye_of_Sauron_-_Ghtic.com_-_Blog.png?v=1579680018".to_string(),
|
|
);
|
|
|
|
let monitor =
|
|
SystemMonitor::new(system_monitor::resource_threshold::get_default_resource_thresholds());
|
|
|
|
let formatter = system_monitor::alert_formatter::AlertFormatter;
|
|
|
|
let service = app::service::new(notifier, monitor, formatter);
|
|
service.run();
|
|
}
|