From ca28cddfd00dadb33f066cac8c00f7058eeb73c5 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Dec 2024 20:42:50 -0500 Subject: [PATCH] should now pass dry run flag in main() --- hwmonDaemon.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hwmonDaemon.py b/hwmonDaemon.py index 25276ba..da8bcf8 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -374,12 +374,25 @@ class SystemHealthMonitor: def main(): try: + # Argument parser for CLI options + parser = argparse.ArgumentParser(description="System Health Monitor") + parser.add_argument( + "--dry-run", + action="store_true", + help="Enable dry-run mode (simulate ticket creation without actual API calls)." + ) + args = parser.parse_args() + # Parse command-line arguments or read from configuration file ticket_api_url = "http://10.10.10.45/create_ticket_api.php" state_file = "/tmp/last_health_check.json" # Instantiate the SystemHealthMonitor class - monitor = SystemHealthMonitor(ticket_api_url=ticket_api_url, state_file=state_file) + monitor = SystemHealthMonitor( + ticket_api_url=ticket_api_url, + state_file=state_file, + dry_run=args.dry_run # Pass the dry-run flag + ) # Run the health checks monitor.run()