From 8edb40a8e97e40765b3b0ea1be6a1c79d5cc3edd Mon Sep 17 00:00:00 2001 From: Tony Fernandez Date: Wed, 23 Oct 2024 17:38:24 -0400 Subject: [PATCH] added dryrun check --- borgmatic/hooks/zabbix.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/borgmatic/hooks/zabbix.py b/borgmatic/hooks/zabbix.py index 4676968c..d3802757 100644 --- a/borgmatic/hooks/zabbix.py +++ b/borgmatic/hooks/zabbix.py @@ -66,8 +66,9 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev elif username and password is not None: logger.info(f'{config_filename}: Using user/pass auth with user {username} for Zabbix') - response = requests.post(base_url, headers=headers, data='{"jsonrpc":"2.0","method":"user.login","params":{"username":"'+username+'","password":"'+password+'"},"id":1}') - data['auth'] = response.json().get('result') + if not dry_run: + response = requests.post(base_url, headers=headers, data='{"jsonrpc":"2.0","method":"user.login","params":{"username":"'+username+'","password":"'+password+'"},"id":1}') + data['auth'] = response.json().get('result') elif username is not None: logger.warning( f'{config_filename}: Password missing for Zabbix authentication' )