feat: Add env variable for monitor interval
All checks were successful
Lint & Compile Check / check (push) Successful in 5s
All checks were successful
Lint & Compile Check / check (push) Successful in 5s
This commit is contained in:
@@ -229,6 +229,9 @@ if __name__ == "__main__":
|
||||
parser.add_argument("--test", action="store_true", help="Send a fake test notification and exit")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Update interval from environment if provided as override
|
||||
interval = int(os.getenv("MONITOR_INTERVAL", args.interval))
|
||||
|
||||
if args.test:
|
||||
import random
|
||||
test_ip, test_name = random.choice(list(CLIENTS.items()))
|
||||
@@ -239,10 +242,10 @@ if __name__ == "__main__":
|
||||
logger.info("Test notification sent. Exiting.")
|
||||
exit(0)
|
||||
|
||||
logger.info(f"AdGuard Monitor Service Started. Interval: {args.interval}s")
|
||||
logger.info(f"AdGuard Monitor Service Started. Interval: {interval}s")
|
||||
logger.info(f"Monitoring {len(CLIENTS)} clients: {', '.join([f'{name} ({ip})' for ip, name in CLIENTS.items()])}")
|
||||
session = get_auth_session()
|
||||
|
||||
while True:
|
||||
fetch_and_analyze(session, verbose=args.verbose)
|
||||
time.sleep(args.interval)
|
||||
time.sleep(interval)
|
||||
|
||||
Reference in New Issue
Block a user