diff --git a/README.md b/README.md index a8f5fc94b5484cf9935c22663ad66496a05ada6a..1059af1ee73ab8b1a9d380fa968b5e8a8b2b0fce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/squid-2.1.1-20240514.mkp "squid-2.1.1-20240514.mkp" +[PACKAGE]: ../../raw/master/mkp/squid-2.1.2-20250309.mkp "squid-2.1.2-20250309.mkp" # Squid Web Proxy This CheckMK plugin monitors the performance of the _**Squid Web Proxy**_. This plugin is intended to use with the Agent Bakery of CheckMK. diff --git a/mkp/squid-2.1.2-20250309.mkp b/mkp/squid-2.1.2-20250309.mkp new file mode 100644 index 0000000000000000000000000000000000000000..29ca326adf5c594d6888fd9c6f8f9b806ccfc820 Binary files /dev/null and b/mkp/squid-2.1.2-20250309.mkp differ diff --git a/source/agents/plugins/squid b/source/agents/plugins/squid index a3fb775d6ab89cb18edfb0c6db043c0dd605b831..2f85c6e21b0eb916e41bb267225f53049d0dd824 100755 --- a/source/agents/plugins/squid +++ b/source/agents/plugins/squid @@ -10,6 +10,8 @@ # changed section from check_squid to squid # 2023-05-22: fixed missing "<" in section name # 2023-12-02: added -l "$ip_address" option +# 2025-03-09: changed to prefer curl/wget over squidclient ThX to mk-hs@forum.checkm.com +# (see: https://bugs.squid-cache.org/show_bug.cgi?id=5283#c10) # # squidclient mgr:server_list # squidclient mgr:info @@ -38,13 +40,27 @@ if [ -z "$ip_address" ]; then ip_address=localhost fi -if type squidclient > /dev/null 2>&1 ; then +if type wget > /dev/null 2>&1 ; then + echo "<<<squid_file_descriptors:sep(0)>>>" + wget -q -O - http://"$ip_address":"$port"/squid-internal-mgr/info | grep "file descriptors" + + echo "<<<squid:sep(0)>>>" + wget -q -O - http://"$ip_address":"$port"/squid-internal-mgr/5min | grep "=" + +elif type curl > /dev/null 2>&1 ; then + echo "<<<squid_file_descriptors:sep(0)>>>" + curl http://"$ip_address":"$port"/squid-internal-mgr/info | grep "file descriptors" + + echo "<<<squid:sep(0)>>>" + curl http://"$ip_address":"$port"/squid-internal-mgr/5min | grep "=" + +elif type squidclient > /dev/null 2>&1 ; then echo "<<<squid_file_descriptors:sep(0)>>>" squidclient -p "$port" -l "$ip_address" -T2 mgr:info | grep "file descriptors" echo "<<<squid:sep(0)>>>" # one squid instance - squidclient -p "$port" -l "$ip_address" -T2 mgr:5min | grep = + squidclient -p "$port" -l "$ip_address" -T2 mgr:5min | grep "=" # multiple squid instances # instance names must be without spaces and with colon char at the end diff --git a/source/gui/wato/check_parameters/squid_bakery.py b/source/gui/wato/check_parameters/squid_bakery.py index a028355a2bfe965e11b07806482512d71f6dd9d0..232faffe5b6214e0cb3743f5123e128e228d31f4 100644 --- a/source/gui/wato/check_parameters/squid_bakery.py +++ b/source/gui/wato/check_parameters/squid_bakery.py @@ -20,21 +20,26 @@ # add available_number_of_file_descriptors for check section # 2024-05-14: moved to check_parameters # separated WATO for bakery and check in two files +# 2025-03-08: added option to decide if the plugin should be installed from cmk.gui.i18n import _ from cmk.gui.valuespec import ( Dictionary, Integer, TextInput, + DropdownChoice, ) from cmk.gui.plugins.wato.utils import ( HostRulespec, rulespec_registry, ) -from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import ( - RulespecGroupMonitoringAgentsAgentPlugins, -) +try: + from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import ( + RulespecGroupMonitoringAgentsAgentPlugins, + ) +except ImportError: + exit() def _valuespec_agent_squid(): @@ -42,6 +47,15 @@ def _valuespec_agent_squid(): help=_('The plugin <tt>squid</tt> allows monitoring of Squid Web Proxies.'), title=_('Squid Web Proxy (Linux)'), elements=[ + ('install_plugin', + DropdownChoice( + title=_('Install the plugin'), + choices=[ + ('true', _('Install the plugin')), + ('false', _('Don\'t install the plugin')) + ], + default='true', + )), ('ip_address', TextInput( title=_('IP Address/Hostname'), diff --git a/source/lib/python3/cmk/base/cee/plugins/bakery/squid.py b/source/lib/python3/cmk/base/cee/plugins/bakery/squid.py index 05189f7429ba15994015d97a55d6b182b6898576..3b285e92e88cb25a599cbbf2af794a587f7395ae 100644 --- a/source/lib/python3/cmk/base/cee/plugins/bakery/squid.py +++ b/source/lib/python3/cmk/base/cee/plugins/bakery/squid.py @@ -17,6 +17,7 @@ # 2023-09-21: moved file to ~/local/lib/check_mk/base/cee/plugins/bakery # fix crash if port not configured in wato # 2023-12-02: added IP-Address option +# 2025-03-08: added option to decide if the plugin should be installed from pathlib import Path from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( @@ -29,6 +30,8 @@ from cmk.base.cee.plugins.bakery.bakery_api.v1 import ( def get_squid_files(conf) -> FileGenerator: + if conf.get('install_plugin') == 'false': + return yield Plugin( base_os=OS.LINUX, source=Path('squid'), diff --git a/source/packages/squid b/source/packages/squid index 9d4835c9df05830d76bfb2b262fc0f40a244988a..508805b9601c2dc38aa5e764842454c9ce86d0eb 100644 --- a/source/packages/squid +++ b/source/packages/squid @@ -15,7 +15,7 @@ 'lib': ['python3/cmk/base/cee/plugins/bakery/squid.py']}, 'name': 'squid', 'title': 'Squid3 Health Check', - 'version': '2.1.1-20240514', + 'version': '2.1.2-20250309', 'version.min_required': '2.1.0b1', 'version.packaged': 'cmk-mkp-tool 0.2.0', 'version.usable_until': '2.4.0b1'}