Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeout options to zabbix_settings #1427

Merged
merged 9 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/pr_1427.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- zabbix_settings - add support for additional timeout settings
194 changes: 194 additions & 0 deletions plugins/modules/zabbix_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,77 @@
- A text of iframe sandboxing exceptions.
required: false
type: str

timeout_zabbix_agent:
description:
- A time of zabbix agent timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_simple_check:
description:
- A time of simple check timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_snmp_agent:
description:
- A time of SNMP agent timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_external_check:
description:
- A time of external check timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_db_monitor:
description:
- A time of db monitor timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_http_agent:
description:
- A time of HTTP agent timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_ssh_agent:
description:
- A time of SSH agent timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_telnet_agent:
description:
- A time of telnet agent timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_script:
description:
- A time of script timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

timeout_browser:
description:
- A time of browser timeout.
- This parameter is available since Zabbix 7.0
required: false
type: str

connect_timeout:
description:
- A time of connection timeout with Zabbix server.
Expand Down Expand Up @@ -403,6 +474,7 @@
alert_usrgrp: "0"
auditlog_enabled: false
blink_period: "10m"
timeout_zabbix_agent: "30s"
connect_timeout: "30s"
custom_color: false
default_inventory_mode: automatic
Expand Down Expand Up @@ -509,6 +581,16 @@
x_frame_options,
iframe_sandboxing_enabled,
iframe_sandboxing_exceptions,
timeout_zabbix_agent,
timeout_simple_check,
timeout_snmp_agent,
timeout_external_check,
timeout_db_monitor,
timeout_http_agent,
timeout_ssh_agent,
timeout_telnet_agent,
timeout_script,
timeout_browser,
connect_timeout,
socket_timeout,
media_type_test_timeout,
Expand Down Expand Up @@ -800,6 +882,88 @@
"iframe_sandboxing_exceptions"
] = iframe_sandboxing_exceptions

if LooseVersion(self._zbx_api_version) >= LooseVersion("7.0"):
if isinstance(timeout_zabbix_agent, str):
if self._is_time(timeout_zabbix_agent):
if timeout_zabbix_agent != current_settings["timeout_zabbix_agent"]:
params["timeout_zabbix_agent"] = timeout_zabbix_agent

Check warning on line 889 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L889

Added line #L889 was not covered by tests

if isinstance(timeout_simple_check, str):
if self._is_time(timeout_simple_check):
if timeout_simple_check != current_settings["timeout_simple_check"]:
params["timeout_simple_check"] = timeout_simple_check

Check warning on line 894 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L894

Added line #L894 was not covered by tests

if isinstance(timeout_snmp_agent, str):
if self._is_time(timeout_snmp_agent):
if timeout_snmp_agent != current_settings["timeout_snmp_agent"]:
params["timeout_snmp_agent"] = timeout_snmp_agent

Check warning on line 899 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L899

Added line #L899 was not covered by tests

if isinstance(timeout_external_check, str):
if self._is_time(timeout_external_check):
if timeout_external_check != current_settings["timeout_external_check"]:
params["timeout_external_check"] = timeout_external_check

Check warning on line 904 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L904

Added line #L904 was not covered by tests

if isinstance(timeout_db_monitor, str):
if self._is_time(timeout_db_monitor):
if timeout_db_monitor != current_settings["timeout_db_monitor"]:
params["timeout_db_monitor"] = timeout_db_monitor

Check warning on line 909 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L909

Added line #L909 was not covered by tests

if isinstance(timeout_http_agent, str):
if self._is_time(timeout_http_agent):
if timeout_http_agent != current_settings["timeout_http_agent"]:
params["timeout_http_agent"] = timeout_http_agent

Check warning on line 914 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L914

Added line #L914 was not covered by tests

if isinstance(timeout_ssh_agent, str):
if self._is_time(timeout_ssh_agent):
if timeout_ssh_agent != current_settings["timeout_ssh_agent"]:
params["timeout_ssh_agent"] = timeout_ssh_agent

Check warning on line 919 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L919

Added line #L919 was not covered by tests

if isinstance(timeout_telnet_agent, str):
if self._is_time(timeout_telnet_agent):
if timeout_telnet_agent != current_settings["timeout_telnet_agent"]:
params["timeout_telnet_agent"] = timeout_telnet_agent

Check warning on line 924 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L924

Added line #L924 was not covered by tests

if isinstance(timeout_script, str):
if self._is_time(timeout_script):
if timeout_script != current_settings["timeout_script"]:
params["timeout_script"] = timeout_script

Check warning on line 929 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L929

Added line #L929 was not covered by tests

if isinstance(timeout_browser, str):
if self._is_time(timeout_browser):
if timeout_browser != current_settings["timeout_browser"]:
params["timeout_browser"] = timeout_browser

Check warning on line 934 in plugins/modules/zabbix_settings.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/zabbix_settings.py#L934

Added line #L934 was not covered by tests

else:
if isinstance(timeout_zabbix_agent, str):
self._module.fail_json(msg="'timeout_zabbix_agent' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_simple_check, str):
self._module.fail_json(msg="'timeout_simple_check' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_snmp_agent, str):
self._module.fail_json(msg="'timeout_snmp_agent' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_external_check, str):
self._module.fail_json(msg="'timeout_external_check' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_db_monitor, str):
self._module.fail_json(msg="'timeout_db_monitor' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_http_agent, str):
self._module.fail_json(msg="'timeout_http_agent' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_ssh_agent, str):
self._module.fail_json(msg="'timeout_ssh_agent' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_telnet_agent, str):
self._module.fail_json(msg="'timeout_telnet_agent' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_script, str):
self._module.fail_json(msg="'timeout_script' unsupported in Zabbix server versions prior to 7.0")

if isinstance(timeout_browser, str):
self._module.fail_json(msg="'timeout_browser' unsupported in Zabbix server versions prior to 7.0")

if isinstance(connect_timeout, str):
if self._is_time(connect_timeout):
if connect_timeout != current_settings["connect_timeout"]:
Expand Down Expand Up @@ -942,6 +1106,16 @@
x_frame_options=dict(type="str"),
iframe_sandboxing_enabled=dict(type="bool"),
iframe_sandboxing_exceptions=dict(type="str"),
timeout_zabbix_agent=dict(type="str"),
timeout_simple_check=dict(type="str"),
timeout_snmp_agent=dict(type="str"),
timeout_external_check=dict(type="str"),
timeout_db_monitor=dict(type="str"),
timeout_http_agent=dict(type="str"),
timeout_ssh_agent=dict(type="str"),
timeout_telnet_agent=dict(type="str"),
timeout_script=dict(type="str"),
timeout_browser=dict(type="str"),
connect_timeout=dict(type="str"),
socket_timeout=dict(type="str"),
media_type_test_timeout=dict(type="str"),
Expand Down Expand Up @@ -1028,6 +1202,16 @@
x_frame_options = module.params["x_frame_options"]
iframe_sandboxing_enabled = module.params["iframe_sandboxing_enabled"]
iframe_sandboxing_exceptions = module.params["iframe_sandboxing_exceptions"]
timeout_zabbix_agent = module.params["timeout_zabbix_agent"]
timeout_simple_check = module.params["timeout_simple_check"]
timeout_snmp_agent = module.params["timeout_snmp_agent"]
timeout_external_check = module.params["timeout_external_check"]
timeout_db_monitor = module.params["timeout_db_monitor"]
timeout_http_agent = module.params["timeout_http_agent"]
timeout_ssh_agent = module.params["timeout_ssh_agent"]
timeout_telnet_agent = module.params["timeout_telnet_agent"]
timeout_script = module.params["timeout_script"]
timeout_browser = module.params["timeout_browser"]
connect_timeout = module.params["connect_timeout"]
socket_timeout = module.params["socket_timeout"]
media_type_test_timeout = module.params["media_type_test_timeout"]
Expand Down Expand Up @@ -1093,6 +1277,16 @@
x_frame_options,
iframe_sandboxing_enabled,
iframe_sandboxing_exceptions,
timeout_zabbix_agent,
timeout_simple_check,
timeout_snmp_agent,
timeout_external_check,
timeout_db_monitor,
timeout_http_agent,
timeout_ssh_agent,
timeout_telnet_agent,
timeout_script,
timeout_browser,
connect_timeout,
socket_timeout,
media_type_test_timeout,
Expand Down
Loading
Loading