diff --git a/src/app/service.rs b/src/app/service.rs index 4f390b8..114fff2 100644 --- a/src/app/service.rs +++ b/src/app/service.rs @@ -21,7 +21,7 @@ pub fn new( } impl Service { - pub fn run(&self) { + pub fn alert_on_threshold_violation(&self) { // Check for threshold violations and send alerts let violations = self.monitor.check_thresholds(); for violation in violations { @@ -30,7 +30,9 @@ impl Service { .send_notification(&message) .expect("Failed to send notification"); } + } + pub fn send_all_metrics_notification(&self) { // Send a final notification with all system information let summary = self.formatter.format_summary(&self.monitor.get_metrics()); self.notifier diff --git a/src/main.rs b/src/main.rs index aa441ac..852922a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,5 +45,6 @@ fn main() { Box::new(system_monitor_adapter), Box::new(formatter), ); - service.run(); + service.alert_on_threshold_violation(); + service.send_all_metrics_notification(); }