diff --git a/README.md b/README.md index 4bf67e2c8553f5e3bc4817b9f3df051a33bcf554..ebc2514020f7041d5ee6267c3aa16c22583ff9f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/unbound-1.2.1-20240514.mkp "unbound-1.2.1-20240514.mkp" +[PACKAGE]: ../../raw/master/mkp/unbound-1.2.2-20240521.mkp "unbound-1.2.2-20240521.mkp" # unbound This agent plugin cheks the state of the unbound dns daemon. For more information about unbound see: https://nlnetlabs.nl/projects/unbound/about/ diff --git a/mkp/unbound-1.2.2-20240521.mkp b/mkp/unbound-1.2.2-20240521.mkp new file mode 100644 index 0000000000000000000000000000000000000000..6041172279b075a9fd310b5281e281c94afac0ae Binary files /dev/null and b/mkp/unbound-1.2.2-20240521.mkp differ diff --git a/source/agents/plugins/unbound b/source/agents/plugins/unbound index 52d336ec0382ce2508c119ccc05a8fc6fee50bdc..0d77bf11841119c22aaaca2ea9c26e63bbdcc288 100755 --- a/source/agents/plugins/unbound +++ b/source/agents/plugins/unbound @@ -1,4 +1,16 @@ #!/bin/sh -echo '<<<unbound:sep(61)>>>' -unbound-control stats_noreset -echo '<<<>>>' + +PLUGIN_CONF_DIR="/etc/check_mk" +UNBOUND_CFG="/etc/unbound/unbound.conf" + +if [ -f "$MK_CONFDIR/unbound.cfg" ]; then + . "$MK_CONFDIR/unbound.cfg" 2>/dev/null +elif [ -f "$PLUGIN_CONF_DIR/unbound.cfg" ]; then + . "$PLUGIN_CONF_DIR/unbound.cfg" 2>/dev/null +fi + +if [ -f "$(which unbound-control)" ]; then + echo '<<<unbound:sep(61)>>>' + unbound-control stats_noreset -c $UNBOUND_CFG + echo '<<<>>>' +fi diff --git a/source/gui/wato/check_parameters/unbound_bakery.py b/source/gui/wato/check_parameters/unbound_bakery.py index 525038ded77f5de739da6cbc2108d83b5cb0d6d9..e7fa11f2ddc8d043dc6a5e63045ea52dfbfcf1b0 100644 --- a/source/gui/wato/check_parameters/unbound_bakery.py +++ b/source/gui/wato/check_parameters/unbound_bakery.py @@ -35,24 +35,35 @@ from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import ( RulespecGroupMonitoringAgentsAgentPlugins, ) -from cmk.gui.valuespec import Alternative, FixedValue +from cmk.gui.valuespec import ( + Alternative, + Dictionary, + FixedValue, + TextInput, +) def _parameter_valuespec_unbound_bakery(): return Alternative( - title=_('unbound'), + title='Unbound', elements=[ - FixedValue( - True, - title=_('Deploy the unbound agent plugin'), - totext=_('The unbound agent plugin will be deployed') - ), + Dictionary( + title='Deploy the unbound agent plugin', + elements=[ + ('config_file_path', + TextInput( + title=_('Path of config file'), + size=100, + allow_empty=False, + placeholder='/etc/unbound/unbound.conf', + )) + ]), FixedValue( None, title=_('Do not deploy the unbound agent plugin'), totext=_('The unbound agent plugin will not be deployed') ), - ], + ] ) diff --git a/source/lib/python3/cmk/base/cee/plugins/bakery/unbound.py b/source/lib/python3/cmk/base/cee/plugins/bakery/unbound.py index ac4f50de0799d0302c5b5616f4181436bceec7f4..3134fe5b4beae4ea6b66bbf381fad4601ee62a9d 100644 --- a/source/lib/python3/cmk/base/cee/plugins/bakery/unbound.py +++ b/source/lib/python3/cmk/base/cee/plugins/bakery/unbound.py @@ -16,6 +16,7 @@ from pathlib import Path from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( FileGenerator, + PluginConfig, OS, Plugin, register @@ -23,11 +24,17 @@ from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( def get_unbound_files(conf) -> FileGenerator: - if conf is True: + if conf: yield Plugin( base_os=OS.LINUX, source=Path('unbound'), ) + if config_file_path := conf.get('config_file_path'): + yield PluginConfig( + base_os=OS.LINUX, + lines=[f'UNBOUND_CFG={config_file_path}'], + target=Path('unbound.cfg'), + ) register.bakery_plugin( diff --git a/source/packages/unbound b/source/packages/unbound index 517e0450f73c524b6e7ae39f4ef1c4b978e6265e..087be7f33ca6601c9045461237b3c83f2d9fd9dd 100644 --- a/source/packages/unbound +++ b/source/packages/unbound @@ -15,7 +15,7 @@ 'lib': ['python3/cmk/base/cee/plugins/bakery/unbound.py']}, 'name': 'unbound', 'title': 'Unbound', - 'version': '1.2.1-20240514', + 'version': '1.2.2-20240521', 'version.min_required': '2.2.0b1', 'version.packaged': '2.2.0p24', 'version.usable_until': None}